Base64Encode()

Converts plain text to Base64-encoded binary data.

Availability 

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ❌ No

Syntax 

1Base64Encode(stringToEncode, characterEncoding)

The Base64Encode() function has two parameters:

  • stringToEncode (string): Required. The string to encode to Base64.
  • characterEncoding (string): The character encoding type to use when encoding the string. Accepted values: ASCII, UTF-7, UTF-8, UTF-16, and UTF-32.

Usage 

To use the function, pass it the string that you want to encode. Optionally, specify the type of character encoding to use.

1%%[
2  Var @couponCode, @couponCodeB64
3  Set @couponCode = "6dn28uqxocqu"
4  Set @couponCodeB64 = Base64Encode(@couponCode)
5]%%
6<p>%%=v(@couponCodeB64)=%%</p>

The example code outputs a string encoded in Base64.

1NmRuMjh1cXhvY3F1