Binary to hex converter
Paste binary and read it back in hexadecimal: 11010110 becomes D6 and 11111111 becomes FF. Pick uppercase, lowercase or a 0x prefix, and open "Show the working" to see each group of four bits matched to its hex digit.
Show the working
Runs in your browser. Nothing you type is uploaded.
How to use the converter
- Type or paste binary numbers, one per line or separated by spaces.
- Choose how the hex should look in the Output menu.
- Copy, download or share the result.
Width and Signed. Set Width to 8, 16, 32 or 64 bits to pad the hex to a fixed size, so 101101 at 16 bits becomes 002D. Tick Signed if the binary is a two's complement value; the hex digits stay the same, and the decimal shown under the boxes becomes the signed value. That row also gives octal, with a click to copy. Open file loads a .txt or .csv list of binary numbers.
A 0b prefix and underscores in the input are ignored, so 0b1101_0110 works. Each space-separated group is treated as its own number. If you have one long binary string with spaces every 8 bits and want it read as one value, remove the spaces first.

What the converter does with different binary
Each input below was typed into the converter on this page, with Output on Uppercase and Width on Auto unless the row says otherwise.
| Input | What you get |
|---|---|
100111100 (9 bits, so the first group is padded) | 13C, decimal 316 |
0b1101_0110 (prefix and underscore) | D6 |
1101 0110 (the same bits with a space) | D 6, two separate numbers. Remove the space to get D6. |
111011.111 (a binary point) | 3B.E, decimal 59.875 |
0.101 (a short fraction) | 0.A, padded on the right to 1010 |
-101101 (minus sign) | -2D |
00000000 (all zeros) | 0. With Width on 8-bit it shows 00. |
10110101 with Output set to Lowercase | b5 |
10110101 with Output set to 0x prefix | 0xB5 |
| 64 ones, a full 64-bit value | FFFFFFFFFFFFFFFF, every digit kept, decimal 18446744073709551615 |
100000000 with Width 8-bit | No result. The message says it does not fit in 8 bits and that the largest 8-bit value is 11111111. |
1012 (a digit that is not 0 or 1) | No result. The message names the 2, and Show me jumps to it. |

How to convert binary to hexadecimal
Hex is base 16, and 16 is 24, so every hex digit stands for exactly four bits. That turns the conversion into a lookup rather than a calculation:
- Split the binary into groups of four, starting from the right.
- If the leftmost group is short, pad it with zeros on the left.
- Replace each group with its hex digit. The bits in a group are worth 8, 4, 2 and 1, so
1101is 8 + 4 + 1 = 13, which is D.

Take 101101. From the right, the groups are 1101 and 10. Pad the short one to 0010. 0010 is 2 and 1101 is D, so the answer is 2D. As a check, 2 × 16 + 13 = 45, and the binary to decimal converter gives 45 for 101101 too.
Grouping from the left instead of the right is the usual slip. It splits 101101 into 1011 and 01, which gives B4 if you pad the end, a completely different number.
Binary to hex table
These sixteen patterns are all you need. A group of four bits is called a nibble, half a byte, and a full byte is always two hex digits, from 00 to FF.

| Binary | Hex | Decimal | Binary | Hex | Decimal |
|---|---|---|---|---|---|
0000 | 0 | 0 | 1000 | 8 | 8 |
0001 | 1 | 1 | 1001 | 9 | 9 |
0010 | 2 | 2 | 1010 | A | 10 |
0011 | 3 | 3 | 1011 | B | 11 |
0100 | 4 | 4 | 1100 | C | 12 |
0101 | 5 | 5 | 1101 | D | 13 |
0110 | 6 | 6 | 1110 | E | 14 |
0111 | 7 | 7 | 1111 | F | 15 |
Worked examples
| Binary | Groups of four | Hex | Decimal |
|---|---|---|---|
1101 | 1101 | D | 13 |
01000000 | 0100 0000 | 40 | 64 |
1101100 | 0110 1100 | 6C | 108 |
10001110 | 1000 1110 | 8E | 142 |
10110101 | 1011 0101 | B5 | 181 |
11111111 | 1111 1111 | FF | 255 |
100111100 | 0001 0011 1100 | 13C | 316 |
110010111 | 0001 1001 0111 | 197 | 407 |
Notice that 110010111 becomes 197 in hex. Hex results can be made of digits only, which is why a 0x prefix is useful in code: 0x197 is 407, while plain 197 would be read as decimal.

Why programmers write binary as hex
A 32-bit value written in binary is 32 characters long and easy to misread. In hex it is eight characters, and you can still see every bit because each digit maps to a fixed group of four, so hex to binary gets you the original bits back exactly.

That is why memory addresses, color codes like #FF8800, MAC addresses, file signatures and network packets are all shown in hex. When those bytes are character codes, hex to text turns them back into readable words. The Wikipedia page on hexadecimal covers the notation used in different languages, such as 0x in C and JavaScript and &H in Visual Basic.
Binary fractions in hex
After the binary point, group from the point towards the right and pad on the right. 111011.111 splits into 0011 1011 before the point and 1110 after it, which gives 3B.E. Likewise 0.1011 is 0.B, and 0.101 is padded to 0.1010, which is 0.A.
Binary to hex in code
Python: hex(int('101101', 2)) returns '0x2d' (the built-in hex() function always writes lowercase with a 0x prefix), and format(int('101101', 2), 'X') returns '2D'. JavaScript: parseInt('101101', 2).toString(16) returns "2d"; for more than 53 bits use BigInt('0b' + bits).toString(16).
Frequently asked questions
What is 11111111 in hexadecimal?
FF. Each 1111 nibble is F, and FF is 255 in decimal.
What is binary 1101 in hex?
D. 1101 is 8 + 4 + 1 = 13, and 13 is written D in hex.
What is 01000000 in hex?
40. The groups are 0100 (4) and 0000 (0). It is 64 in decimal, and the ASCII code for the @ sign.
Is hex the same as binary?
No, but they describe the same values. Binary uses two digits and hex uses sixteen, so one hex digit replaces four binary digits. FF and 11111111 are the same number written two ways.
Should hex be uppercase or lowercase?
Either is correct and they mean the same value. Uppercase is common in documentation and lowercase in code and CSS. Pick whichever matches where you will paste it.
What is 01100110 in hex?
66. The groups are 0110 and 0110, and each is 6. As a byte it is 102 in decimal, which is the letter f in ASCII.

