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.
- Write the value as bits: 11111010
- Split the bits into groups of four, from the right: 1111 1010
- The group 1111 is the hex digit F.
- The group 1010 is the hex digit A.
- The result is 0xFA.
Every hex digit as four bits
| Hex | Binary | Decimal |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| A | 1010 | 10 |
| B | 1011 | 11 |
| C | 1100 | 12 |
| D | 1101 | 13 |
| E | 1110 | 14 |
| F | 1111 | 15 |
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 editorQuestions 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.