Binary to hex: four bits, one digit, no arithmetic
What this conversion does
It regroups a binary string into blocks of four bits and writes each block as a single base 16 digit. No arithmetic beyond a sixteen-entry lookup table is involved, which makes this the one conversion worth doing by eye. It is the standard way to read a bit pattern that has grown too long to scan reliably.
Why groups of four line up perfectly
Sixteen is 2 to the fourth power, so 4 binary positions correspond exactly to one base 16 digit — there is never a remainder and never a partial group. This is why hexadecimal is preferred over octal for byte-oriented data: eight bits split into 2 groups of 4, whereas 3 does not divide eight. Padding a short leading group with zeros keeps the alignment without changing the value.
Binary to hex conversion table
The sixteen possible four-bit groups with their hexadecimal digits. Memorising this table is the entire skill — after that, binary to hex is transcription rather than calculation.
| Binary | Hexadecimal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 10 | 2 |
| 11 | 3 |
| 1010 | A |
| 1111 | F |
| 10000 | 10 |
| 101010 | 2A |
| 11111111 | FF |
| 100000000 | 100 |
The conversion you do while debugging
When a protocol field, a register or a bitmask arrives as binary and the documentation lists it in hex, this is the translation in the middle. Doing it in four-bit groups also gives you a running check: if the total number of bits is not a multiple of four, a bit has been dropped somewhere, and you find that out before the value misleads you.
Pad the leading group, do not guess it
A string of six bits is one and a half digits, which is not a thing. Pad the left-hand group with zeros to make four — 101011 becomes 0010 1011 — and convert that. Guessing the alignment instead is how a value ends up wrong by a factor of sixteen.
Frequently asked questions
How do I convert binary to hex by hand?
Split the bits into groups of four starting from the right, pad the leftmost group with zeros if it is short, then replace each group with its hexadecimal digit. 10011100 becomes 1001 1100, which is 9C.
Why group from the right and not the left?
Because the right-hand end holds the lowest place values, and the grouping has to follow place value to be meaningful. Grouping from the left shifts every digit when the length is not a multiple of four, which silently changes the number rather than merely misaligning it.
How many hex digits does a byte need?
Exactly two, since a byte is eight bits and four bits make one digit. That fixed relationship is why hexadecimal became the default notation for byte-oriented data, and it is the reason you can read a memory dump as a sequence of two-digit pairs.
Does the converter handle long bit strings?
Yes. A 64-bit value becomes sixteen hexadecimal digits, and the conversion is exact rather than approximate — the tool uses integer arithmetic throughout, so nothing is lost at the large end of the range where floating point would start rounding.
Can I paste binary that already has spaces in it?
Yes. Spaces and underscores are removed before converting, so binary copied from a terminal, a datasheet or a diff works without being tidied up first. The grouping you see in the source has no effect on the value.