---
schema_version: "1"
id: fc51ddcdcf40bd5d9e2d35ef3e26ab7e7af6544d4caf102a9c6e703216849ca2
title: toHex
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-binaries-functions-tohex.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-binaries-functions-tohex
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 651defcb0b29cc00d96570b63971313c78cfbe49ef97ead96508d73c434cf1d6
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# toHex

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## toHex(content: Binary): String

Transforms a binary value into a hexadecimal string.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>content</code></p></td><td><p>The <code>Binary</code> value to transform.</p></td></tr></tbody></table>

### Example

This example transforms a binary version of "Mule" (defined in the variable, `myBinary`) to
hexadecimal.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Binaries
output application/json
var myBinary = "Mule" as Binary
var testType = typeOf(myBinary)
---
{
   "binaryToHex" : toHex(myBinary)
}
```

#### Output

```JSON
{ "binaryToHex": "4D756C65" }
```
