Skip to content

Binary to Hex Converter

Type or paste binary and get the hex value as you type, with the decimal value as a check. Switch direction to turn hex back into binary.

4 bits = 1 hex digit

Hex
35A

10 bits → 3 hex digits · 2 zeros added on the left · decimal 858

How to Convert Binary to Hex

Hex has 16 digits (0–9, then A–F for ten to fifteen), and four binary digits also have exactly 16 patterns, from 0000 to 1111. So every group of 4 bits is one hex digit, and you can convert without any arithmetic:

  1. Starting from the right, split the binary number into groups of 4.
  2. If the leftmost group is short, add zeros to its left until it has 4 digits. This doesn't change the value.
  3. Swap each group for its hex digit from the chart below.
  4. Write the hex digits in the same order. That's the answer.
4 bits = 1 hex digit  ·  8 bits (1 byte) = 2 hex digits

Worked Example: 1101011010 to Hex

A typical homework question: convert 1101011010 to hexadecimal. It has 10 digits, which doesn't divide by 4, so it needs the padding step.

Step 1: Group in fours from the right

11  0101  1010

Step 2: Pad the short group on the left

0011  0101  1010

Step 3: Look up each group

0011 = 3  ·  0101 = 5  ·  1010 = A

Step 4: Check it through decimal (optional)

35A = 3×256 + 5×16 + 10 = 858  ·  1101011010 = 512+256+64+16+8+2 = 858

Result: 1101011010 in binary = 35A in hex (858 in decimal). The tool above starts with this number loaded.

Binary to Hex Chart

All 16 groups of 4 bits and the hex digit each one becomes. A quick way to work one out: the four places are worth 8, 4, 2 and 1, so 1011 is 8 + 2 + 1 = 11 = B.

Binary to hex conversion chart for 4-bit groups
BinaryHexDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

Common Mistakes

Common binary to hex mistakes
MistakeWrongRight
Grouping from the left instead of the right1101 0110 1000 = D6835A
Typing the bits into a decimal-to-hex converter, which reads 1010 as one thousand and ten1010 → 3F2A
Mixing up 1011 (B) and 1101 (D)1011 = DB

Grouping from the left is the most common one. It adds zeros to the end of the number, which makes it bigger: D68 is exactly 4 times 35A. Extra zeros only ever go on the left. If the number you have is decimal rather than binary, use the number base converter instead.

Converting Binary Bytes and Text to Hex

Binary is often written as a row of 8-digit bytes, such as 01001000 01101001. Each byte becomes two hex digits. Choose the 03 5A format to keep one pair per byte: the result is 48 69, which spells "Hi". To see which letters a row of hex bytes spells, use the UTF-8 converter.

Leave Keep leading zeros on for bytes, so 00001111 gives 0F rather than F. Both are the same number, but a byte is always written with two digits. Each line in the box is converted separately, so you can paste a column of values and copy back a column of hex.

Binary to Hex in Excel, Python, JavaScript and on a Calculator

Each of these turns 11111011 into FB. On Windows you can also use the built-in Calculator: open the menu, choose Programmer, click BIN, type the bits and read the HEX line.

Converting binary to hex in common tools
ToolHow
Excel or Google Sheets (up to 10 digits)=BIN2HEX(A2)
Excel or Google Sheets (longer numbers)=BASE(DECIMAL(A2, 2), 16)
Pythonformat(int(s, 2), 'X')
JavaScriptBigInt('0b' + s).toString(16).toUpperCase()
Javanew BigInteger(s, 2).toString(16).toUpperCase()
C# (up to 64 bits)Convert.ToInt64(s, 2).ToString("X")

Excel's BIN2HEX stops at 10 digits and treats a 10-digit number starting with 1 as negative, so use the BASE formula for anything longer. Going the other way? See the hex to binary converter.

Frequently asked questions

How many hex digits does a binary number need?

Divide the number of binary digits by 4 and round up. A byte (8 bits) is 2 hex digits, 16 bits is 4, and 32 bits is 8.

Why do programmers write binary as hex?

Hex is four times shorter than binary but still lines up exactly with the bits. 11111111 is FF in hex, which shows all eight bits are on; 255 in decimal gives no such hint.

Is 1010 the same as A?

Yes. 1010 in binary, A in hex and 10 in decimal are the same number. To show which one you mean, write 1010₂ and A₁₆, or 0b1010 and 0xA in code.

How do I convert binary to octal instead?

Use groups of 3 bits instead of 4, because octal has 8 digits. 1101011010 becomes 001 101 011 010 = 1532 in octal.

Sources