Binary.ToList

Binary

Converts a binary value into a list of byte numbers (0-255).

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Binary.ToList(binary as binary) as list

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary value to convert to a list of byte values.

Return Value

listA list of numbers (each 0 to 255) representing the individual bytes of the binary value.

Remarks

Binary.ToList converts a binary value into a list of numbers, where each number represents a single byte (0 to 255). This is the inverse of Binary.FromList.

This function is useful for inspecting binary data at the byte level, performing byte-level transformations, or debugging binary content.

Examples

Example 1: Convert a binary value to a list of bytes

let
    Source = Binary.From("Hi"),
    Bytes = Binary.ToList(Source)
in
    Bytes
Applied Steps

Converts the binary value to a list of byte values: {72, 105}, corresponding to the ASCII codes for 'H' and 'i'.

Value
1{72, 105}

Example 2: Round-trip from list to binary and back

let
    Original = {0, 127, 255},
    AsBinary = Binary.FromList(Original),
    BackToList = Binary.ToList(AsBinary)
in
    BackToList
Applied Steps

Converts the binary back to a list of byte values, confirming the round-trip produces {0, 127, 255}.

Value
1{0, 127, 255}

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks