Handlebars Helper Function: base64Decode

Converts Base64-encoded binary data to plain text.

Availability 

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

Syntax 

1{{base64Decode stringToDecode
2  characterEncoding="CHARSET" [abortSendOnFail=true|false]}}

Parameters 

ParameterTypeDescription
stringToDecodeStringRequired. The Base64-encoded string to decode.
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.
abortSendOnFailBooleanIndicates whether to abort a send if stringToDecode can’t be decoded. Specify as a named parameter.

Return Value 

The function returns the decoded plain-text value.

Usage Example 

This example decodes a Base64-encoded coupon code that was retrieved from a marketing object so that it can be displayed to a subscriber as plain text.

1{{base64Decode "NmRuMjh1cXhvY3F1"}}

The function returns this decoded string:

16dn28uqxocqu

Handling Decoding Failures 

This example decodes a value that isn’t valid Base64 data, and sets the value of abortSendOnFail to false so that an email send continues even if decoding fails.

1{{base64Decode invalidEncodedValue characterEncoding="UTF-8" abortSendOnFail=false}}

If invalidEncodedValue can’t be decoded, the helper returns an empty string instead of stopping the send.