Function Problems

Convert a 24-Bit Binary Number to Hexadecimal in Excel

Elise WilliamsElise Williams Nov 14, 2026 868 views

Question details

Convert a 24-bit binary value into a six-character hexadecimal value in Excel.

Convert a 24-Bit Binary Number to Hexadecimal in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A binary value is stored in a worksheet and needs to be converted to hexadecimal without losing zeros.
Observed behavior
The desired result is a six-character hexadecimal value, including any leading or internal zeros.
Before you start

Format the input cell as Text before entering the value, or type an apostrophe before the binary digits. Make sure the value contains exactly 24 digits, using only 0 and 1.

Solution 1Recommended

Convert three 8-bit sections with BIN2HEX

Use this formula to convert a 24-bit binary text value into a six-character hexadecimal result.

BIN2HEX accepts up to 10 binary digits at a time. Splitting the value into three 8-bit sections keeps each section within that limit, while the second argument pads each result to two hexadecimal characters.

1
Enter the binary value

Select cell A1, set its format to Text, and enter the 24 binary digits. For example, enter 010001011011000100001011.

2
Enter the formula

Select another cell and enter =BIN2HEX(LEFT(A1,8),2)&BIN2HEX(MID(A1,9,8),2)&BIN2HEX(RIGHT(A1,8),2).

3
Check the result

Press Enter. The example returns 45B10B, with two hexadecimal characters for each 8-bit section.

Check your separators: Depending on your Excel regional settings, you may need to replace commas in the formula with semicolons.
Convert binary in WPS Spreadsheet

Convert 24-Bit Binary to Hexadecimal in WPS Spreadsheet

Use BIN2HEX in WPS Spreadsheet to convert three 8-bit sections and combine them into a six-character hexadecimal value.

  1. 1. Open a spreadsheet: Open WPS Spreadsheet and create or open a workbook.
  2. 2. Enter the binary text: Format cell A1 as Text and enter exactly 24 binary digits.
  3. 3. Add the conversion formula: In another cell, enter =BIN2HEX(LEFT(A1,8),2)&BIN2HEX(MID(A1,9,8),2)&BIN2HEX(RIGHT(A1,8),2).
  4. 4. View the result: Press Enter to display the six-character hexadecimal value.
Convert 24-bit binary text while preserving hexadecimal zerosOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and cell formatting
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I use BIN2HEX on all 24 bits at once?

BIN2HEX accepts at most 10 binary digits. Split the 24-bit value into three 8-bit sections, convert each section, and join the results with &.

How do I keep zeros in the hexadecimal result?

Use 2 as the second argument of each BIN2HEX call, such as BIN2HEX(LEFT(A1,8),2). This pads each section to two hexadecimal characters.

Why should the binary value be stored as text?

Text preserves leading zeros and avoids Excel's 15-digit numeric precision limit. Format A1 as Text before typing the value, or enter an apostrophe before the digits.

What should I check if the formula returns an error?

Check that A1 contains exactly 24 characters made up only of 0 and 1. Also replace formula commas with semicolons if your regional settings require them.