---
schema_version: "1"
id: bde6072e80a9c8d85322b2d71d5a24ade486a388be26f8acb7d57987f9e14c90
title: fromHex
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-numbers-functions-fromhex.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-numbers-functions-fromhex
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 56213d932ee2d288e7351c4482b5abc9490c791a1ba9ac3dec4f52169a4034ea
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

# fromHex

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

## fromHex(hexText: String): Number

Transforms a hexadecimal number into decimal number.

_Introduced in DataWeave version 2.2.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>hexText</code></p></td><td><p>The hexadecimal number represented in a <code>String</code>.</p></td></tr></tbody></table>

### Example

This example shows how the `toBinary` behaves with different inputs.

#### Source

```DataWeave
%dw 2.0
import fromHex from dw::core::Numbers
output application/json
---
{
    a: fromHex("-1"),
    b: fromHex("3e3aeb4ae1383562f4b82261d969f7ac94ca4000000000000000"),
    c: fromHex(0),
    d: fromHex(null),
    e: fromHex("f"),
}
```

#### Output

```JSON
{
  "a": -1,
  "b": 100000000000000000000000000000000000000000000000000000000000000,
  "c": 0,
  "d": null,
  "e": 15
}
```

## fromHex(hexText: Null): Null

Helper function that enables `fromHex` to work with null value.

_Introduced in DataWeave version 2.2.0._
