How the binary to hex converter works
Type bits into the Binary field and the hex value appears in the result card as you type, with the decimal and octal values beneath it. The nibble panel pads the bits on the left to a whole number of four-bit groups, draws them as a grid numbered from bit 0 on the right, and lists every group with its 8 + 4 + 2 + 1 sum and the hex digit it becomes.
Typing in the Hex field runs the same table in reverse. Because the converter uses whole-number arithmetic with no rounding, a 128-bit address or a 64-character hash converts digit for digit. For decimal or any base from 2 to 36, use the binary converter.
The nibble rule
Example: 1101 = 8 + 4 + 0 + 1 = 13, which is the hex digit D.
Worked examples
Example 1 — a length that is not a multiple of four
- Binary:
- 1011101
- Group from the right: 101 1101
- Pad the left group: 0101 1101
- 0101 = 4 + 1, 1101 = 8 + 4 + 1: 5, 13
Hex: 5D
Check: 5 × 16 + 13 = 93, and 1011101 is 64 + 16 + 8 + 4 + 1 = 93.
Example 2 — hex back to binary
- Hex:
- 2F8
- 2: 0010
- F (15): 1111
- 8: 1000
Binary: 1011111000
The two leading zeros from the first group are dropped.
The 16 nibbles: binary, hex and decimal
| Binary | Hex | Decimal |
|---|---|---|
| 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 | A | 10 |
| 1011 | B | 11 |
| 1100 | C | 12 |
| 1101 | D | 13 |
| 1110 | E | 14 |
| 1111 | F | 15 |
Key facts
- One hexadecimal digit stands for exactly four binary digits, because 16 is 2 to the power 4.
- Binary converts to hex by splitting the bits into groups of four from the right and replacing each group with one hex digit.
- A byte is 8 bits, so it is always written as two hex digits, from 00 to FF.
- The 4-bit pattern 1111 is the hex digit F, which is 15 in decimal.
Where you meet binary and hex together
Hex is how people read binary without counting thirty-two 0s and 1s. Programmers see it in memory dumps, colour codes such as #FF8800 (one byte each for red, green and blue), bit masks like 0xF0, and file signatures. Network engineers read MAC and IPv6 addresses in hex, and students meet it in computer science courses — binary and hexadecimal, and converting between them, are part of England's GCSE computer science content (source: DfE subject content). When the bits are meant as characters rather than a number, the binary to text converter decodes them instead.
Common binary to hex mistakes
- Grouping from the left. 1011101 grouped as 1011 101 gives B and 5 — wrong. Group from the right: 101 1101 is 5D.
- Writing 10 instead of A. A nibble worth ten to fifteen is one digit, A to F. Writing 1010 as “10” adds a digit and changes the value.
- Dropping zeros inside the number. Leading zeros can go, but 0000 in the middle of a number is the digit 0 and must stay.
- Mixing up prefixes. In code 0x10 is sixteen and 0b10 is two; a bare 10 is ten.
Frequently Asked Questions
What is 11111111 in hex?
11111111 is FF in hex. Split it into 1111 and 1111; each group is 8 + 4 + 2 + 1 = 15, which is the hex digit F. It is also 255 in decimal, the largest value one byte can hold.
How do you convert hex to binary?
Replace each hex digit with its 4-bit pattern from the nibble table and join them. 3F becomes 0011 1111, and 7A2 becomes 0111 1010 0010. Leading zeros on the far left can be dropped.
Why group binary digits from the right?
The rightmost bit is always the 1s place, so groups counted from the right line up with hex places: the first four bits are the 16⁰ digit, the next four the 16¹ digit, and so on. Grouping from the left only works when the length is already a multiple of four.
Why does one hex digit equal exactly four bits?
Because 16 is 2⁴. Four bits can make 2 × 2 × 2 × 2 = 16 patterns, from 0000 to 1111, and hexadecimal has exactly 16 digits, 0–9 and A–F. That one-to-one match is why programmers use hex as shorthand for binary.
How many hex digits is a byte?
Two. A byte is 8 bits, which is two nibbles, so every byte is written as two hex digits from 00 to FF. A 32-bit value takes 8 hex digits and a 64-bit value takes 16.
What does the 0x in front of a hex number mean?
0x is the prefix programming languages such as C, Java and JavaScript use to mark a number as hexadecimal, so 0x1F means hex 1F (31), not a decimal number. Binary literals use 0b in the same way. This converter accepts both prefixes as typed.
Related calculators
Notes & Assumptions
- Binary and hex input is read as a whole number, exactly, up to 4,096 characters long.
- A minus sign is kept as a sign. A negative number stored in a computer is a two's complement pattern, which the twos complement calculator produces.
- Binary fractions such as 0.101 are not converted here.
This tool is for education and general calculation. Check values used in production code against your platform's documentation.