Binary to hex, step by step
Pad the left end to a multiple of 4 digits, split into 4-bit groups, then look up each group's hex digit:
0001→11010→A
Joined together: 1A = 1A
0-F nibble table: 4-bit binary to hex
Every 4-bit binary pattern and its exact hex digit:
| Binary (4-bit) | Decimal | Hex |
|---|---|---|
0000 | 0 | 0 |
0001 | 1 | 1 |
0010 | 2 | 2 |
0011 | 3 | 3 |
0100 | 4 | 4 |
0101 | 5 | 5 |
0110 | 6 | 6 |
0111 | 7 | 7 |
1000 | 8 | 8 |
1001 | 9 | 9 |
1010 | 10 | A |
1011 | 11 | B |
1100 | 12 | C |
1101 | 13 | D |
1110 | 14 | E |
1111 | 15 | F |
More number-base converters
- Hex to binary converter
- Hex to decimal converter
- Decimal to hex converter
- Binary to decimal converter
- Decimal to binary converter
- Binary translator (text ↔ binary bytes, not plain numbers)
Frequently asked questions
How do I convert binary to hex by hand?
Starting from the right, split the binary digits into groups of 4 (padding the leftmost group with zeros if needed), then look up each 4-bit group's hex digit. For 11010: pad to 00011010, split into 0001 and 1010, which are 1 and A -- giving 1A. The tool above shows this grouping for whatever you type.
What is 11111111 in hex?
11111111 splits into 1111 and 1111, both F, so it's FF. That's 8 ones, the largest value a single byte can hold.
Why do I split binary into groups of 4 for hex?
Because hex is base 16 and 16 = 2^4, every possible 4-bit pattern maps to exactly one hex digit (0-F). Splitting binary into groups of 4 -- starting from the right, since that's where place value starts -- and converting each group independently gives the exact hex equivalent with no arithmetic.
What if the binary length is not a multiple of 4?
Pad extra zeros onto the LEFT (the most-significant end) until the length is a multiple of 4 -- padding on the right would change the value. This tool does that padding automatically before grouping.
Does this handle negative or very large binary numbers?
Yes to both. A leading minus sign (e.g. -11111111) is read as a negative value and produces a signed hex result (-FF). Numbers of any size are handled exactly using JavaScript BigInt internally, so there's no floating-point rounding no matter how many bits you paste in.
How do I convert binary to hex in code?
JavaScript: parseInt("11010", 2).toString(16).toUpperCase(). Python: hex(int("11010", 2)) (returns "0x1a"), or format(int("11010", 2), "X") for uppercase without the prefix.
How is binary to hex different from converting through decimal?
It isn't mathematically different -- binary 11010 and hex 1A both equal decimal 26. But grouping into 4-bit chunks and looking up each one is faster and less error-prone than converting binary to decimal and then decimal to hex, since it's a pure lookup with no multiplication or division.
What are hex digits A-F worth in binary?
A=1010, B=1011, C=1100, D=1101, E=1110, F=1111 -- see the full 4-bit nibble table above for every possible binary group.