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.

Hex to binary

Show the working
One number per line, or separate them with spaces.0 numbers
Reviewed bySam Siewert
Last updated · How we test

Runs in your browser. Nothing you type is uploaded.

How to use the converter

  1. Type or paste binary numbers, one per line or separated by spaces.
  2. Choose how the hex should look in the Output menu.
  3. 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.

How to convert binary to hex

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:

  1. Split the binary into groups of four, starting from the right.
  2. If the leftmost group is short, pad it with zeros on the left.
  3. Replace each group with its hex digit. The bits in a group are worth 8, 4, 2 and 1, so 1101 is 8 + 4 + 1 = 13, which is D.
Binary 101101 split into the groups 0010 and 1101 from the right, with two padding zeros added on the left. The groups become the hex digits 2 and D, so the answer is 2D.

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.

Chart of all sixteen 4-bit binary patterns from 0000 to 1111 with their hex digits 0 to 9 and A to F and decimal values 0 to 15.
BinaryHexDecimalBinaryHexDecimal
000000100088
000111100199
0010221010A10
0011331011B11
0100441100C12
0101551101D13
0110661110E14
0111771111F15

Worked examples

BinaryGroups of fourHexDecimal
11011101D13
010000000100 00004064
11011000110 11006C108
100011101000 11108E142
101101011011 0101B5181
111111111111 1111FF255
1001111000001 0011 110013C316
1100101110001 1001 0111197407

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.

The 32-bit binary value 11000000101010000000000100000001 split into eight nibbles that read C0A80101 in hex, which is the IP address 192.168.1.1.

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.

Is my input sent anywhere?

No. The conversion happens in your browser.

Scroll to Top