Hex to Binary
One hex digit is exactly four bits, so this conversion is pure substitution — no arithmetic, no carrying, and the bit boundaries never move.
Runs 100% in your browser•Nothing is uploaded to a server•Free forever
Hexadecimal
Binary
There is no arithmetic in this one
Hex to binary is the one conversion on this site that needs no division, no multiplication and no carrying. Sixteen is two to the fourth, so one hex digit maps onto exactly four bits and always the same four bits, regardless of what is on either side of it. Replace each digit with its nibble, concatenate, and you are finished: 2F becomes 0010 and 1111, which is 00101111.
| Hex | Binary | Decimal |
|---|---|---|
0 | 0000 | 0 |
1 | 0001 | 1 |
2 | 0010 | 2 |
3 | 0011 | 3 |
4 | 0100 | 4 |
5 | 0101 | 5 |
6 | 0110 | 6 |
7 | 0111 | 7 |
8 | 1000 | 8 |
9 | 1001 | 9 |
A | 1010 | 10 |
B | 1011 | 11 |
C | 1100 | 12 |
D | 1101 | 13 |
E | 1110 | 14 |
F | 1111 | 15 |
That table is the entire conversion. It is worth learning by heart, because it also runs backwards for binary to hex, and because it is the reason hex exists at all: it is a shorthand for binary that a person can read aloud, where every digit still lines up with a fixed group of bits. Base 10 has no such property — there is no fixed number of bits per decimal digit — which is why a decimal number tells you nothing about its own bit pattern at a glance.
Keep the leading zeros
Each hex digit expands to four bits including any leading zeros, so 5 is 0101, not 101. Dropping them is the usual way this goes wrong: 0x15 is 0001 0101, and writing it as 1 0101 makes it look like a five-bit value. Set a width above and the output is padded to the full 8, 16, 32 or 64 bits so the columns line up against whatever you are comparing it with.
Why this is the conversion you want for flags
When documentation gives you a status word as 0x2C and a table of what each bit means, the fast route is not through decimal. Expand straight to 0010 1100, then read off bits 5, 3 and 2 as set. Going via decimal (44) throws away exactly the structure you were trying to read, and then you have to convert back.
The same applies to masks. An RGB channel mask of 0x00FF0000 is obviously "the second byte" once expanded, and much less obviously 16,711,680 in decimal.
Related: binary to hex for the return trip, hex to decimal when you want a magnitude rather than a pattern, and the full converter.
More developer tools
- JSON Formatter
- Base64 Encode / Decode
- URL Encoder / Decoder
- Unix Timestamp Converter
- Regex Tester
- UUID Generator (v4 / v7)
- Hash Generator (MD5 / SHA / HMAC)
- JWT Decoder
- Password Generator
- JSON ⇄ CSV Converter
- HTML Entity Encoder / Decoder
- Cron Expression Explainer
- Color Converter
- WCAG Contrast Checker
- All tools on one page (home)