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


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:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation:
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.