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

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

Parameters

Parameter Type Description
stringToDecode String Required. The Base64-encoded string to decode.
characterEncoding String The character encoding to use. Specify as a named parameter with one of these values: ASCII, UTF-7, UTF-8, UTF-16, or UTF-32.
abortSendOnFail Boolean Indicates 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.

{{base64Decode "NmRuMjh1cXhvY3F1"}}

The function returns this decoded string:

6dn28uqxocqu

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.

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

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