Beetwise

Why hex suits binary values

One hex digit shows exactly four bits.

Two hex digits show exactly one byte.

Hex is shorter than binary, and each digit maps to a fixed group of bits. A decimal digit does not.

Try hex notation in the bit editor

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

7
6
5
4
3
2
1
0
0xFA
hex · 8 bits
value
250

Hex notation step by step

Convert 11111010 into hex:

  1. Split the bits into groups of four, from the right: 1111 and 1010.
  2. Convert the first group: 1111 is F.
  3. Convert the second group: 1010 is A.
  4. 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 hex notation is used

A data sheet gives register addresses and reset values in hex.

A hex value shows the bit pattern directly, so a change of one digit changes exactly four bits.

A decimal value hides the bit pattern, which makes a mask hard to read.

Hex notation: points to note

  • A decimal digit does not map to a group of bits. The value 10 in decimal covers parts of two bit groups.
  • The prefix 0x marks a hex value. The prefix 0b marks a binary value.
  • A hex value with an odd number of digits is not a whole number of bytes. Add a zero at the left for clarity.

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 hex notation

How many bits does one hex digit hold?
One hex digit holds exactly four bits, which gives the values 0 to 15.
Why is 0xFF used so often?
The value 0xFF is one full byte with all bits set. The value is the mask for one byte.
Is hex the same as binary?
Hex is a shorter form of the same bits. The value does not change, only the display.