Skip to content
CalcWorld

Browse all tools

Binary to Hex Converter

The binary to hex converter groups the bits in fours from the right and turns each group into one hex digit: 1010 1010 = AA. It also converts hex back to binary, four bits for every digit.

Sources: Wikipedia Updated

Binary to hex

Hex to binary

How the binary and hex conversion works

• Binary to Hex: Groups binary digits into sets of 4 bits (nibbles) and converts each nibble directly to its hexadecimal equivalent

• Hex to Binary: Converts each hexadecimal digit directly to its 4-bit binary representation

• Supports common hex formats: with or without '0x' prefix

How binary to hex conversion works

Binary to hex is a grouping shortcut that never goes through decimal. Since 16 is 2⁴, every group of four bits, called a nibble, matches exactly one hex digit.

The converter pads your input with zeros on the left until its length is a multiple of 4, splits it into nibbles and looks up each one. That is why a byte is always two hex digits.

How to convert binary to hex

  1. Group the bits in fours from the right: 10101010 becomes 1010 1010. Pad the leftmost group with zeros if it is short.
  2. Turn each group into its value with the place values 8, 4, 2, 1: 1010 = 8 + 2 = 10.
  3. Write each value as a hex digit: 10 is A, so 1010 1010 = AA.

Check through decimal: 10101010 is 170 in the binary to decimal converter, and 170 = 10 × 16 + 10, which is AA. The result matches.

The binary number 10101010 split into two groups of four bits, 1010 and 1010. Each group is 10, the hex digit A, so the result is AA.
Two groups of four bits make two hex digits, so one byte is always two hex digits.

Hex to binary: four bits per digit

The reverse writes each hex digit as four bits. AA becomes 1010 and 1010, so 10101010 again. The separate hex to binary converter works through a longer example, 1A3F.

Binary to hex chart

BitsHexBitsHexBitsHexBitsHex
0000001004100081100C
0001101015100191101D
00102011061010A1110E
00113011171011B1111F

Input rules

The binary box accepts only 0 and 1. The hex box accepts 0 to 9 and A to F in either case, and it strips an optional 0x prefix. Leading zeros are trimmed from the binary result unless the whole answer is 0.

Where hex stands in for binary

Hex is the short way to write groups of bits: memory addresses, register dumps and colour codes. #FF0000 is three bytes, red 255, green 0 and blue 0, each written as two hex digits.

Octal does the same with groups of three bits; see the binary to octal converter. Every conversion is listed on the number system converters page.

Binary to Hex Converter: FAQ

Why does binary convert to hex in groups of four?

Because 16 = 2⁴. Four bits have exactly 16 patterns, 0000 to 1111, and hexadecimal has exactly 16 digits, 0 to F.

What is 11111111 in hex?

FF. Each group 1111 is 15, the hex digit F. In decimal it is 255.

What if the number of bits is not a multiple of four?

Add zeros on the left until it is. 111010110 has 9 bits, so it becomes 0001 1101 0110, which is 1D6.

Sources