0xCONVERTER-HEX

Guide

Hex vs Binary

Hex is binary, compressed four bits at a time and made readable.

They are the same information

Unlike hex and decimal, which represent values differently, hex and binary represent the same bits in the same order. Hex is purely a compression of binary for human eyes.

1100 0000 1101 1110      binary  — 16 characters
  C    0    D    E        hex     —  4 characters

identical bits, one quarter the width

Because the mapping is digit-by-digit with no arithmetic, converting between them is mechanical in both directions. Nothing is lost and nothing is approximated.

Side by side

BinaryHexadecimal
Base216
Symbols0, 10–9, A–F
Bits per character14
One byte8 characters2 characters
A 32-bit value32 characters8 characters
A SHA-256 hash256 characters64 characters
Individual bitsDirectly visibleOne step away
Error-prone to readVeryMuch less so

When you genuinely need binary

Hex hides individual bits behind a digit. Usually that is a feature. Sometimes it is not.

  • Explaining a bitwise operation. AND, OR, XOR and shifts are much clearer when the operands are lined up bit by bit.
  • Single-bit flags. When a register packs eight independent booleans, the binary view shows all eight at once.
  • Teaching. Two's complement, sign bits and overflow only make sense when the bits are visible.
  • Hardware interfaces. Datasheets describe registers bit by bit, and matching the datasheet layout prevents mistakes.
masking, shown in binary

  value  1010 1101
  mask   0000 1111   (0F)
  AND    ---------
         0000 1101   → only the low nibble survives

the same operation in hex

  AD & 0F = 0D

The hex line is shorter and the binary lines are clearer. For a one-line comment in code, use hex. For an explanation, use binary.

Why four bits, exactly

Sixteen is 24, so one hex digit covers exactly four bit positions with no overlap and no remainder. That is the property everything else depends on.

Hex digitsBitsCommon name
14Nibble
28Byte
416Word
832Doubleword
1664Quadword

Every one of those is a whole number of hex digits. That is not true of any other readable base, which is why hex is the standard for writing binary data and always has been.

Reading hex as bits without converting

Once the sixteen patterns are learned, you can read the bits straight out of a hex digit. These four cover most practical cases.

Hex digitBitsRecognise it as
81000Only the top bit of the nibble
F1111All four bits
00000No bits
70111All but the top bit
10001Only the bottom bit
The habit worth building

When you see 80, think \u201ctop bit of the byte\u201d rather than \u201cone hundred and twenty-eight\u201d. When you see 7F, think \u201ceverything but the top bit\u201d. Reading hex as bit patterns rather than quantities is the point at which hex starts saving you time.

Converting

Both directions are mechanical. Expand each digit to four bits, or group bits into fours from the right. The hex to binary converter and binary to hex converter handle any length, and the reference table lists every byte.

Frequently asked questions

What is the difference between hex and binary?

They represent the same bits. Hex packs four bits into each character, so it is a quarter the length and much easier to read without losing any information.

Is hex just shorthand for binary?

Effectively yes. Each hex digit is exactly four bits, so conversion is a direct substitution with no arithmetic.

Why not just use binary?

Length and error rate. A 32-bit value is 32 binary characters or 8 hex characters, and miscounting a long run of ones is very easy.

When should I use binary instead?

When individual bits matter: explaining bitwise operations, reading single-bit flags, or matching a hardware datasheet.

How many bits is one hex digit?

Exactly four, called a nibble. Two hex digits make one byte.

Does converting hex to binary lose anything?

No. The conversion is exact in both directions, because the mapping is one digit to four bits.