Hex to binary converter
Type a hexadecimal (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.
Show the working
Runs in your browser. Nothing you type is uploaded.
How to use the converter
- Type or paste hex values. Upper and lower case both work, and
0x,#or a trailinghare accepted. - Choose plain binary, 8-bit padding, 4-bit groups, 8-bit groups or a
0bprefix. - 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.
What the converter does with different hex
Hex copied from code, a color picker or a datasheet comes in several shapes. Each input below was typed into the converter on this page, with Output on Plain and Width on Auto unless the row says otherwise.
| Input | What you get |
|---|---|
0x2ED (C-style prefix) | 1011101101 |
2EDh (assembly suffix) | 1011101101 |
$2ED (Pascal-style prefix) | 1011101101 |
2ed (lowercase) | 1011101101 |
#FF8800 (a color code) | 111111111000100000000000. All 24 bits as one number. Pick 8-bit groups to see red, green and blue apart. |
FF_FF (underscore between groups) | 1111111111111111 |
1A.8 (a hex fraction) | 11010.1. The 8 after the point is 8/16, one half, which is .1 in binary. The decimal line shows 26.5. |
-2ED (minus sign) | -1011101101 |
2E D (a space inside the value) | 101110 and 1101, two separate values. Remove the space. |
2ED with Output set to Pad to 8 bits | 0000001011101101, padded to two full bytes, 16 bits |
2ED with Output set to 4-bit groups | 0010 1110 1101 |
FF with Width 8-bit and Signed ticked | 11111111. The bits do not change. The decimal line under the boxes reads -1. |
1FF with Width 8-bit | No result. The message says 1FF does not fit in 8 bits and that the largest 8-bit value is FF. |
\x48 (escape from a C or Python string) | Not accepted. Delete the \x first. |
G1 (a letter past F) | No result. The message says hex can only use 0 to 9 and A to F, and names the G. |

How to convert hexadecimal 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.

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

| Hex | Binary | Hex | Binary |
|---|---|---|---|
| 0 | 0000 | 8 | 1000 |
| 1 | 0001 | 9 | 1001 |
| 2 | 0010 | A | 1010 |
| 3 | 0011 | B | 1011 |
| 4 | 0100 | C | 1100 |
| 5 | 0101 | D | 1101 |
| 6 | 0110 | E | 1110 |
| 7 | 0111 | F | 1111 |
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
| Hex | Digit by digit | Binary | Decimal |
|---|---|---|---|
1F | 0001 1111 | 11111 | 31 |
2F | 0010 1111 | 101111 | 47 |
7F | 0111 1111 | 1111111 | 127 |
A0 | 1010 0000 | 10100000 | 160 |
F0 | 1111 0000 | 11110000 | 240 |
FF | 1111 1111 | 11111111 | 255 |
2ED | 0010 1110 1101 | 1011101101 | 749 |
3E8 | 0011 1110 1000 | 1111101000 | 1000 |
DEADBEEF | 1101 1110 1010 1101 1011 1110 1110 1111 | 32 bits | 3735928559 |

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.

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 uninitialized 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.

