DevSwitch.net
Back to Tools
#

Binary to Hexadecimal Converter

Convert binary numbers to hexadecimal format

Number Converters

Tip: Enter a binary number (0s and 1s only). The conversion happens in real-time.

Runs in your browser

Binary Hex

Hex base 16
-
Try

Convert binary to hexadecimal

Type or paste a binary number and the hex result appears as you type, in capital letters. Once it is longer than four digits it is also shown in pairs, one pair per byte, and the window bar shows the bit length.

One hex digit stands for exactly four bits, which makes hex the short way to write binary: a 32-bit value needs 32 binary digits but only 8 hex digits. That is why memory addresses, byte dumps and color codes are written in hex.

How to convert binary to hex by hand

Split the bits into groups of four, starting from the right, and pad the leftmost group with zeros. Then write each group as one hex digit. For 1011011111010:

Group of four bitsHex digit
0001 1
0110 6
1111 F
1010 A

Join the digits: 1011011111010 is 16FA in hex. Always group from the right: groups taken from the left would split the bits in other places and give a wrong number. The step-by-step window above groups your own bits the same way.

Four-bit groups and their hex digits

BitsHexBitsHex
0000 0 1000 8
0001 1 1001 9
0010 2 1010 A
0011 3 1011 B
0100 4 1100 C
0101 5 1101 D
0110 6 1110 E
0111 7 1111 F

Learn these sixteen and you can convert any length by eye. The groups that start with 0 are the digits 0 to 7, the ones that start with 1 are 8 to F, and 1010 to 1111 are the letters A to F.

Have a hex number instead?

The hex to binary converter turns each hex digit back into its four bits.

Signs, prefixes and byte padding

You get

  • A minus sign kept as a sign: -11111111 gives -FF
  • No leading zeros: 00001111 gives F, not 0F
  • A 0b prefix and spaces between groups are skipped, so 0b1111 0000 gives F0

Left to you

  • Two's complement: the bits are always read as a positive number, so a signed byte 11111111 gives FF, not -1
  • Two digits per byte: write 0F yourself if a format needs it
  • A 0x in front of the result: you get the bare digits

For the decimal value of the same bits, use the binary to decimal converter; the number system converter shows binary, decimal, hex and octal at once.

Binary to hex questions

FF. The two groups 1111 and 1111 are each F, and FF is 255 in decimal.

It is four times shorter and still maps straight onto the bits. Each hex digit can be read back as four bits without any arithmetic.

No. The converter adds the missing zeros on the left of the first group, so 101 is read as 0101 and gives 5.

Yes. The letters A to F are written in capitals, with no 0x prefix. Add 0x yourself if your code needs it.

No. The conversion runs in your browser.