Updated on

Binary.FromText is a Power Query M function that converts a text value to a binary value using the specified encoding (Base64 or Hex). The function returns a binary representation of the text value.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365


   text as nullable text,
   optional encoding as nullable number,
) as nullable binary
textThe text to convert into a binary value.
encodingoptionalSpecifies the BinaryEncoding.Type that determines the encoding type applied to binary data.. By default, if this argument is not specified, the function uses BinaryEncoding.Base64, suitable for base-64 encoding. The alternative option available is BinaryEncoding.Hex, used for hexadecimal encoding.


Returns the result of converting text value text to a binary (list of number). encoding may be specified to indicate the encoding used in the text value. The following BinaryEncoding values may be used for encoding.

  • BinaryEncoding.Base64: Base 64 encoding
  • BinaryEncoding.Hex: Hex encoding


Decode “1011” into binary.

// Output: Binary.FromText( "1011", BinaryEncoding.Base64 )
Binary.FromText( "1011" )

Decode “1011” into binary with Hex encoding.

// Output: Binary.FromText( "EBE=", BinaryEncoding.Base64 )
Binary.FromText( "1011", BinaryEncoding.Hex )

Other functions related to Binary.FromText are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: