How to Use Power Query Binary Functions and Convert Binary Values
Question details
The user wants to understand how to use BinaryFormat functions in Power Query to decode binary file content and convert numeric values to binary text.

- Product
- Excel / Power Query
- Device & OS
- not provided
- Scenario
- Decoding binary data from files or converting decimal numbers to binary strings within Power Query.
- Observed behavior
- Power Query lacks direct equivalents to Excel's native DEC2BIN function, requiring specific decoders for file content and custom functions for number-base conversions.
Ensure you have access to the Power Query Editor and understand the difference between reading binary file content (like a loaded CSV) and converting numeric strings into binary format.
Decode Binary File Content Using Built-in Decoders
Use appropriate Power Query decoders to read binary data returned from file sources like Folder.Contents.
Power Query Binary functions are primarily designed to describe and decode binary data from files, rather than performing mathematical base conversions.
Use data source functions like Folder.Contents or File.Contents to load your files into Power Query. The file content will initially appear as a 'Binary' value in the column.
Click the 'Binary' link in the cell, or apply specific decoding functions based on your file type. Use Excel.Workbook for Excel files, Csv.Document for CSV files, or Lines.FromBinary for raw text files.
Once the binary content is decoded into a table format, click the expand icon on the column header to view and manipulate your data inside the Power Query Editor.

Convert Decimal to Binary Using a Custom M Function
Create a custom Power Query (M) function to convert decimal numbers to binary text, as there is no native DEC2BIN function available in Power Query.
Try WPS Office for Seamless Spreadsheet Management
If you find complex Power Query functions and custom M scripts overwhelming, WPS Office offers a lightweight, user-friendly, and free alternative for your daily spreadsheet tasks. Easily perform base conversions using built-in spreadsheet functions without needing to write code.
- 1. Download and install: Visit the official WPS website to download and install the free WPS Office suite.
- 2. Open your spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbooks seamlessly.
- 3. Use native functions: Type =DEC2BIN() directly into any cell to perform instant base conversions without complex queries.

Frequently Asked Questions
Does Power Query have a DEC2BIN function?
No, Power Query does not have a native equivalent to Excel's DEC2BIN or BIN2DEC functions. To convert decimal numbers to binary text in Power Query, you must write or implement a custom M code function.
How do I read binary files in Power Query?
When loading a file, Power Query represents it as a 'Binary' value. You must use a specific decoder function corresponding to the file type, such as Excel.Workbook for Excel files or Csv.Document for CSV files, to extract the readable contents.
What are BinaryFormat functions used for in Power Query?
BinaryFormat functions are advanced functions designed to read, describe, and decode custom binary data structures from files or API responses, rather than performing simple mathematical number-base conversions.




