---
schema_version: "1"
id: 240b56361b480cd1648bc2c88fecf1b550346cb87827294288f5b605a30606e0
title: "Handlebars Helper Function: length"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/handlebars/reference/utility/mcn-handlebars-reference-utility-length.md
canonical_url: https://developer.salesforce.com/docs/marketing/handlebars-for-marketing-cloud-next/references/mcn-handlebars-utility-references/mcn-handlebars-reference-utility-length.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7ff9cbd3f43584cede3f31e1b58641e48bee70a1997f86ec0abde4213cbfcb56
products:
  - Handlebars for Marketing Cloud Next
  - Marketing Cloud
---
# Handlebars Helper Function: length

Returns the number of characters in a specified string or the number of elements in an array.

## Availability

This helper is available in the Winter ’26 release of Marketing Cloud Next.

## Syntax

```handlebars
{{length subject}}
```

## Parameters

| Parameter | Type            | Description                                          |
| --------- | --------------- | ---------------------------------------------------- |
| `subject` | String or Array | Required. The string or array to find the length of. |

## Return Value

The function returns the number of characters in the input string or the number of elements in the input array. If the input is null, it returns 0.

When measuring strings, the function counts all characters including spaces, punctuation, and special characters. Non-string inputs are converted to strings before counting. The function counts Unicode code units (UTF-16 length), so surrogate pairs count as 2 units.
