Cipher Utility

Hex to Binary Converter

E-11

Hexadecimal to binary, four bits for every digit. Runs in your browser; nothing is sent anywhere.

Zeros:
Group:
Spaces:
Case:

Groups of four bits

How to convert by hand

  1. Take one hex digit at a time.
  2. Read A to F as 10 to 15.
  3. Write the digit as four bits: 8, 4, 2, 1.
  4. Join the groups in the same order.

Worked example

B4 = ?

   B      4
  11      4
1011   0100

B is 8 + 2 + 1, 4 is 4:

B4 = 10110100

Cipher Utility reference card Catalog no. E-11

How to convert hex to binary

Write each hex digit as four bits and put the groups together in the same order. The four bits stand for 8, 4, 2 and 1, and the letters A to F stand for 10 to 15.

7 E 3 0111 1110 0011 7E3 = 011111100011 = 11111100011 without the leading zero

You never have to work out the whole number in decimal, so the conversion is just as easy for a 64-digit hash as for a single byte. The working table under the converter shows the value and the four bits for every digit you type.

Hex to binary table

HexBinaryDecimalHexBinaryDecimal
000000 810008
100011 910019
200102 A101010
300113 B101111
401004 C110012
501015 D110113
601106 E111014
701117 F111115

Leading zeros: keep or trim

Every hex digit gives four bits, so 0F gives 00001111 and 1 gives 0001. Keep the zeros when the hex stands for bytes, because a byte should stay 8 bits long. When you only care about the number, the leading zeros mean nothing, and setting Zeros to Trim turns 0F into 1111.

Hex formats the converter reads

3F plain hex 0x3F 0x prefix, common in code #FF8800 colour codes 3Fh h suffix, common in assembly FF 80 3F several numbers, one per gap

Upper and lower case mean the same thing. Numbers separated by a space, a comma or a new line are converted one by one. Set Group to 4 or 8 to put spaces between the bits of each result.

Example: a colour code

The colour #FF8800 is three bytes, one each for red, green and blue. Each byte runs from 00000000 for none of that colour to 11111111 for full strength.

red green blue FF 88 00 11111111 10001000 00000000

Reading bit masks

Programmers write bit masks in hex because, with the table above in mind, the bits are easy to see. 0x80 is 10000000, only the top bit of a byte. 0x0F is 00001111, the low four bits, and 0xF0 is 11110000, the high four.

Hex that holds text

Hex from a file or a network dump often holds text, and turning it into binary will not make it readable. Paste it into the Hex Decoder to see the letters, or use the binary to hex converter to go back the other way.

Questions about hex to binary

What is FF in binary?

11111111. F is 1111, so FF is two groups of four ones. As a decimal number it is 255.

What is 0x1F in binary?

00011111, or 11111 without the leading zeros. The 0x only marks the number as hex. 1 is 0001 and F is 1111.

Why does each hex digit become four bits?

There are 16 hex digits, and four bits have exactly 16 combinations because 2 to the power 4 is 16. So each hex digit matches one group of four bits, and the conversion never needs any arithmetic beyond that table.

How many bits is a hex string?

Four bits per hex digit. 8 hex digits are 32 bits, and a SHA-256 hash written as 64 hex characters is 256 bits.

How do I turn hex into letters?

This page gives you the bits. If the hex holds text, such as 48 65 6C 6C 6F, paste it into the Hex Decoder to read it as letters.

Is my input sent to a server?

No. The conversion runs in your browser with JavaScript, and nothing you type leaves your device.