Handlebar 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 (API version 65.0).

Syntax 

1{{length subject}}

Parameters 

ParameterTypeDescription
subjectString or ArrayRequired. 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.