Binary to Hex Converter

Convert binary integers to compact hexadecimal notation, with a reverse hex-to-binary mode for checking the same value.

Last updated: August 2026 | By Workshelve Team

What Binary to Hex Conversion Does

Binary is base 2, so each digit is either 0 or 1. Hexadecimal is base 16 and uses the symbols 0-9 and A-F. The key relationship is that one hexadecimal digit represents exactly four bits, so a binary integer can be converted by working from right to left in four-bit groups.

If the first group contains fewer than four bits, leading zeros can be added to complete that group without changing the numeric value. For example, 101101 becomes 0010 1101 for grouping purposes, which maps to 2D in hexadecimal.

Hex is useful when a binary value is too long to scan comfortably but you still want its bit structure to remain visible. Common examples include byte values, masks, file or protocol fields, hashes displayed as hex, and hexadecimal values used in source code. CSS also defines hexadecimal notation for sRGB colors, although CSS supports several other color syntaxes too.

How to Convert Binary to Hex

  1. Start at the right edge of the binary number.
  2. Split the bits into groups of four.
  3. Pad only the leftmost group with zeros if it is short.
  4. Replace each 4-bit group with the matching hex digit.

4-bit to Hex Reference

00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F

Binary to Hex Examples

00101101
2D₁₆

8 bits become two hex digits

111010001
1D1₁₆

The leftmost group is padded to four bits

101010101010
AAA₁₆

Repeated 1010 groups map to A

11111111
FF₁₆

Eight 1 bits map to two F digits

Worked Example: 110101101011₂

1. Group the bits
1101  0110  1011
2. Map each nibble
1101 = D  ·  0110 = 6  ·  1011 = B
110101101011₂ = D6B₁₆

Binary to Hex FAQs

Why do binary-to-hex conversions use groups of four bits?

Hexadecimal has 16 symbols and four binary bits have 16 possible patterns. That gives every 4-bit group a one-to-one hexadecimal digit from 0 through F.

What happens when the binary length is not a multiple of four?

The converter pads only the leftmost group with leading zeros before mapping the groups to hex. For example, 10101 is treated as 0001 0101 and becomes 15.

Do leading zeros change the hexadecimal number?

Not for this calculator. It treats the input as an unsigned numeric representation, so leading zeros are not kept in the final result: 00001111 becomes F.

Can I enter spaces, underscores, or a 0b prefix?

No. This page intentionally accepts a plain binary digit string containing only 0 and 1. Remove separators or programming-language prefixes before converting.

Can this converter handle binary values longer than JavaScript’s safe integer range?

Yes. Conversion is performed one four-bit group at a time rather than converting the entire input to a JavaScript Number, so long integer strings do not lose precision during the radix conversion.

Is binary-to-hex conversion the same as converting text to hex?

No. This tool converts a numeric bit string directly between base 2 and base 16. Turning text into hex first requires a character encoding such as UTF-8 to produce bytes.

Why is hexadecimal convenient for inspecting bit patterns?

A single hex digit corresponds to exactly four bits, so bit boundaries remain easy to see while full four-bit groups use one hex digit instead of four binary digits. For values whose leftmost group is shorter than four bits, the overall character-count reduction is approximate rather than exactly four-to-one.

How do I convert a hexadecimal number back to binary here?

Choose Hex → Binary. The reverse mode expands each hex digit to four bits, then removes leading zeros so the result represents the same unsigned numeric value.

Related Tools