Handlebars Helper Function: base64Encode

Converts plain text to Base64-encoded binary data.

This helper is available in the Winter ’27 release of Marketing Cloud Next.

ParameterTypeDescription
stringToEncodeStringRequired. The string to encode.
characterEncodingStringThe character encoding to use. Specify as a named parameter with one of these values: ASCII, UTF-7, UTF-8, UTF-16, or UTF-32.

The function returns the Base64-encoded value of stringToEncode.

This example encodes a coupon code before storing it in a marketing object, so the plain-text value isn’t stored directly.

The function returns this Base64-encoded string:

This example encodes the same string, but specifies UTF-16 character encoding. Because UTF-16 uses more bytes per character, the encoded output is longer.

The function returns: