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

# 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._
