---
schema_version: "1"
id: d36151c93b413df0a3acb9ccf7366cb8ecf2f2b1e854b017ef51fb2b0127db77
title: Base64Decode()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/utilities/mc-ampscript-reference-utilities-base64-decode.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-utilities/mc-ampscript-reference-utilities-base64-decode.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 47d9242fb26832cc4efc38ddaa93c48bf10a2f275ae2de30cc435ef95fd93177
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# Base64Decode()

Converts Base64-encoded binary data to a string of plain text.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>✅ Yes</td>
  </tr>
</table>

## Syntax

```
Base64Decode(stringToDecode, characterEncoding)
```

The `Base64Decode()` function has two parameters:

- `stringToDecode` (string): Required. The Base64-encoded string to decode.
- `characterEncoding` (string): The character encoding type to use when decoding the string. Possible values are `ASCII`, `UTF-7`, `UTF-8`, `UTF-16`, and `UTF-32`.
- `abortSendOnFail` (boolean): Specifies how to handle decoding failures when the function is used in an email. If the value of this parameter is `1`, the email send is aborted if the string can’t be decoded. If the value is `0`, the email send continues even if the string can’t be decoded. The default value is `1`.

## Usage

To use the function, pass it the string that you want to decode. You can specify the type of character encoding to use.

```
%%[
  Var @couponCode, @couponCodeB64
  Set @couponCodeB64 = "NmRuMjh1cXhvY3F1"
  Set @couponCode = Base64Decode(@couponCodeB64)
]%%
<p>%%=v(@couponCode)=%%</p>
```

The example code outputs a string of plain text.

```
6dn28uqxocqu
```
