Hex to binary converter

Type a hex number and see its bits: FF is 11111111 and 3E8 is 1111101000. Each hex digit turns into four bits, and "Show the working" lays out that mapping digit by digit. Pad to 8 bits, split into nibbles or add a 0b prefix from the Output menu.

Binary to hex

Show the working
One number per line, or separate them with spaces.0 numbers
Reviewed bySam Siewert
Last updated · How we test

Runs in your browser. Nothing you type is uploaded.

How to use the converter

  1. Type or paste hex values. Upper and lower case both work, and 0x, # or a trailing h are accepted.
  2. Choose plain binary, 8-bit padding, 4-bit groups, 8-bit groups or a 0b prefix.
  3. Copy, download or share the output.

Width and Signed. Pick a Width to pad the binary to 8, 16, 32 or 64 bits, so 3E8 at 16 bits becomes 0000001111101000. Tick Signed to read the hex as two's complement; the bits stay the same, and the decimal value under the boxes turns negative when the top bit is 1. Octal is shown there too. Open file loads a .txt or .csv list of hex values.

How to convert hex to binary

Write each hex digit as its 4-bit pattern and join the patterns up. Every digit gets all four bits, including zeros, with one exception: zeros at the very front of the result can be dropped because they do not change the value.

Hex 3E8 expanded digit by digit: 3 becomes 0011, E becomes 1110 and 8 becomes 1000, giving 1111101000 once the two leading zeros are dropped.

For 3E8: 3 is 0011, E is 1110 and 8 is 1000. Joined, that is 001111101000, or 1111101000 without the leading zeros, which is 1000 in decimal. For 2F: 2 is 0010 and F is 1111, giving 101111.

The mistake to watch for is dropping zeros from a digit in the middle or at the end. If you write the 0 in A0 as a single 0 instead of 0000, you get 10100 (20) instead of 10100000 (160).

Hex to binary chart

Chart of all sixteen 4-bit binary patterns from 0000 to 1111 with their hex digits 0 to 9 and A to F and decimal values 0 to 15.
HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

A quick way to rebuild any row: the four bits are worth 8, 4, 2 and 1. B is 11, and 11 = 8 + 2 + 1, so B is 1011. If you know A is 10 and F is 15, the letters in between follow in order.

Worked examples

HexDigit by digitBinaryDecimal
1F0001 11111111131
2F0010 111110111147
7F0111 11111111111127
A01010 000010100000160
F01111 000011110000240
FF1111 111111111111255
2ED0010 1110 11011011101101749
3E80011 1110 100011111010001000
DEADBEEF1101 1110 1010 1101 1011 1110 1110 111132 bits3735928559

Where you meet hex to binary

Bit masks are usually written in hex. 0xF0 is 11110000, so ANDing a byte with it keeps the top four bits and clears the bottom four. Seeing the mask in binary makes it obvious which bits it touches. The Wikipedia article on masks has more examples, and the binary calculator runs AND, OR and XOR for you.

Color codes are another everyday case. In the six-digit CSS hex color format, a color is three bytes, one each for red, green and blue.

The CSS color #FF8800 split into red FF (11111111, 255), green 88 (10001000, 136) and blue 00 (00000000, 0).

Type FF8800 and choose "8-bit groups" in the Output menu to get that split in one step. Memory dumps and debuggers work the same way: 0xDEADBEEF, a value programmers often use to mark uninitialised memory, expands to the 32 bits shown in the table above.

Hex that holds text

If your hex is a run of byte values like 48 65 6C 6C 6F, it is probably text. This page treats each group as a number, so 48 69 becomes 1001000 and 1101001. To read the bytes as characters, use hex to text, which turns 48 69 into "Hi".

Hex to binary in code

Python: bin(int('3E8', 16)) returns '0b1111101000', and format(int('3E8', 16), '012b') keeps all twelve bits. JavaScript: parseInt('3E8', 16).toString(2) returns "1111101000"; for long values use BigInt('0x' + hex).toString(2).

To go back from bits to hex, use binary to hex. For the decimal value, try hex to decimal.

Frequently asked questions

What is F in binary?

1111, the largest 4-bit value (15).

What is 0110 in hex?

6. The bits worth 4 and 2 are on, and 4 + 2 = 6, which is the same digit in hex and decimal.

What is 7F in binary?

01111111, or 127 in decimal. It is the largest value a signed 8-bit number can hold.

How many bits is one hex digit?

Four. Two hex digits make one byte of 8 bits, so a 32-bit value is 8 hex digits long.

Can I convert very long hex values?

Yes. A 64-character SHA-256 hash converts exactly. "Pad to 8 bits" adds zeros at the front so the output is a whole number of bytes.

Is my input sent anywhere?

No. Everything runs in your browser.

Scroll to Top