---
schema_version: "1"
id: 847d790ec46af8ffbaacc22caf460ee905484c3ae5d04fe717385f61f803e6db
title: MD5()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/encryption/mc-ampscript-reference-encryption-md5.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-encryption/mc-ampscript-reference-encryption-md5.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 594f9eced6a61c2b3224354ed6634e301e14c3431f0f601dedf917b54c40f7b3
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# MD5()

Converts a string to a 128-bit hexadecimal MD5 hash.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>✅ Yes</td>
  </tr>
</table>

## Syntax

```
MD5(stringToConvert, charSet)
```

The `MD5()` function has two parameters:

- `stringToConvert` (string): Required. The string to encode.
- `charSet` (string): The character set to use for encoding. Accepted values are `UTF-8` and `UTF-16`. The default value is `UTF-8`.

## Usage

To use this function, pass it a string.

```
%%=MD5("This is a string of text.")=%%
```

The function outputs an MD5 hash of the provided string: `7ccb47715d465a9e6a2b7d3c0441da80`

You can also generate the hash using UTF-16 encoding, as in this example.

```
%%=MD5("This is a string of text.", "UTF-16")=%%
```

The function outputs an MD5 hash that uses UTF-16 encoding: `3251ab3b9d54f085f6b57aa3bc134c3c`
