---
schema_version: "1"
id: 86b9ee69fe800c8a54af258655210376eb07bb1427f9c6e223785be7c1efa8f4
title: fromBinary
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-numbers-functions-frombinary.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-numbers-functions-frombinary
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 22e09f6e05ab45a26b0270ca50a8a92d0825b6a9e70b1b469648de45234b255f
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# fromBinary

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

## fromBinary(binaryText: String): Number

Transforms from a binary number into a 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>binaryText</code></p></td><td><p>The binary 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 fromBinary from dw::core::Numbers
output application/json
---
{
    a: fromBinary("-10"),
    b: fromBinary("11111000111010111010110100101011100001001110000011010101100010111101001011100000100010011000011101100101101001111101111010110010010100110010100100000000000000000000000000000000000000000000000000000000000000"),
    c: fromBinary(0),
    d: fromBinary(null),
    e: fromBinary("100"),
}
```

#### Output

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

## fromBinary(binaryText: Null): Null

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

_Introduced in DataWeave version 2.2.0._
