Beetwise

Convert binary to hex

To convert a binary value into hex, split the bits into groups of four.

Start at the right side.

Convert each group into one hex digit.

Try binary to hex conversion in the bit editor

The bits 11111010, which give 0xFA. Edit the expression or select a bit to flip it.

7
6
5
4
3
2
1
0
0xFA
hex · 8 bits
binary
0b11111010

Binary to hex conversion step by step

Convert 11111010 into hex: The steps follow the value above.

  1. Write the value as bits: 11111010
  2. Split the bits into groups of four, from the right: 1111 1010
  3. The group 1111 is the hex digit F.
  4. The group 1010 is the hex digit A.
  5. The result is 0xFA.

Every hex digit as four bits

Every hex digit as four bits
HexBinaryDecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
A101010
B101111
C110012
D110113
E111014
F111115

Where binary to hex conversion is used

A hex form is shorter than a binary form and holds the same bits.

A group of four bits is often one field in a hardware register.

Binary to hex conversion: points to note

  • Always start the groups at the right side. A group at the left side gives a wrong result.
  • Add zeros at the left if the last group has fewer than four bits.
  • The number of hex digits is the number of bits divided by four. A 32-bit value gives eight digits.

The full bit editor

The full editor holds many values, evaluates expressions across them, and reads live values from a serial port.

Open this value in the full editor

Questions about binary to hex conversion

What is 11111010 in hex?
The value is 0xFA. The group 1111 is F and the group 1010 is A.
Why groups of four?
Four bits hold the values 0 to 15, which is exactly the range of one hex digit.
What if the bits do not divide by four?
Add zeros to the left group. The zeros do not change the value.