Handlebars Helper Function: base64Decode
Converts Base64-encoded binary data to plain text.
This helper is available in the Winter ’27 release of Marketing Cloud Next.
| 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. |
The function returns the decoded plain-text value.
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.
The function returns this decoded string:
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.
If invalidEncodedValue can’t be decoded, the helper returns an empty string instead of stopping the send.