#binary
BinaryCreates a binary value from a list of byte values or a base-64 encoded text string.
Syntax
#binary(value as any) as binaryParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | Either a list of byte values (numbers 0–255) or a base-64 encoded text string. |
Return Value
binary — A binary value constructed from the provided bytes or encoded text.
Remarks
#binary is M's literal constructor for creating binary values. It accepts either a list of byte values (integers 0–255) or a base-64 encoded text string.
Binary values in M represent raw byte sequences. They are primarily used when working with binary data sources such as files, streams, or web API responses that return non-text payloads.
When passing a text string, it must be valid base-64. Passing a list of integers outside the 0–255 range produces an error.
Examples
Example 1: Create a binary value from a list of bytes
#binary({72, 101, 108, 108, 111})Result
Result | |
|---|---|
| 1 | SGVsbG8= |
Example 2: Create a binary value from a base-64 string
#binary("SGVsbG8=")Result
Result | |
|---|---|
| 1 | SGVsbG8= |
Example 3: Round-trip binary to text and back
let
Original = #binary({72, 101, 108, 108, 111}),
Encoded = Binary.ToText(Original),
Decoded = Binary.FromText(Encoded)
in
DecodedResult
Result | |
|---|---|
| 1 | SGVsbG8= |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks