Hex to Binary: How to Convert Hexadecimal to Binary

To convert hexadecimal to binary, replace each hex digit with its four-bit binary equivalent and join the groups together.

crossorigin="anonymous">

Hexadecimal (base 16) uses the digits 0 to 9 and the letters A to F. Because 16 is exactly 2 to the power of 4, every hex digit maps to exactly four binary digits, which makes this one of the easiest conversions to do by hand.

Hex to Binary Converter

Type a hex value (with or without a 0x or # prefix) to see it in binary.

The Hex to Binary Table

Memorize this table and the rest is just looking things up.

HexDecimalBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
A101010
B111011
C121100
D131101
E141110
F151111

How to Convert Hex to Binary Step by Step

  1. Write out the hex number one digit at a time.
  2. Replace each digit with its 4-bit group from the table.
  3. Join the groups. You can drop leading zeros at the very start of the result, but never inside it.

Worked Examples

HexDigit by digitBinary
2F2 = 0010, F = 11110010 1111 (101111 without leading zeros)
B4B = 1011, 4 = 01001011 0100
3A73 = 0011, A = 1010, 7 = 01110011 1010 0111 (1110100111 without leading zeros)
FFF = 1111, F = 11111111 1111

As a check, 2F is 47 in decimal, and 101111 is 32 + 8 + 4 + 2 + 1 = 47.

A Longer Example: a Web Color

The color #FF8800 is three bytes: red FF, green 88 and blue 00. In binary that is 1111 1111 1000 1000 0000 0000, which is 24 bits in total. See hexadecimal explained for more on color codes.

The Alternative: Go Through Decimal

You can convert hex to decimal first and then decimal to binary, but it takes more steps. 2F = 2 × 16 + 15 = 47, and 47 in binary is 101111. The direct table method gives the same answer faster.

Common Mistakes

  • Dropping zeros inside a group. The hex digit 2 is 0010, not 10. Keep all four bits for each digit.
  • Mixing up letters. A is 10 (1010) and B is 11 (1011). Upper and lower case mean the same thing.
  • Converting the 0x prefix. The 0x only tells you the number is hex. It is not part of the value.

Where You Will See Hex Converted to Binary

Programmers and network engineers do this constantly. MAC addresses and IPv6 addresses are written in hex, memory addresses in debuggers are shown in hex, and color codes in web design are hex. Seeing the bits behind the digits helps when you work with flags, masks and permissions.

Frequently Asked Questions

What is 0xFF in binary?

11111111, eight bits all set to 1. In decimal that is 255.

What is hex A in binary?

A is 10 in decimal, which is 1010 in binary.

How do I convert binary back to hex?

Group the bits in fours from the right and replace each group with its hex digit. Our guide to binary to hexadecimal shows how.

Related Guides

Leave a Comment