Hexadecimal and binary
Hexadecimal (base 16) writes each group of 4 bits as one digit from 0 to F, so one byte is always two hex digits; it is the language of memory addresses, colors and hashes. Binary (base 2) is how hardware stores every number: each digit is a bit, worth a power of 2.
Expanding hex into bits is how you read individual flags of a status register, a TCP header field or a permission mask.
This page opens the base converter with hexadecimal as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.
Hexadecimal vs binary
| Hexadecimal | binary | |
|---|---|---|
| Base | 16 | 2 |
| Digits | 0–9 A–F | 0 1 |
| Prefix in code | 0x | 0b |
| 255 is written | FF | 11111111 |
How to convert hexadecimal to binary by hand
No arithmetic needed: each 4 bits are one hexadecimal digit. Group the bits from the right (pad with zeros on the left) and translate each group:
| Bits | 1011 | 0011 | 0010 | 1101 |
|---|---|---|---|---|
| Digit | B | 3 | 2 | D |
So 1011001100101101 = B32D (decimal 45869).
Hexadecimal to binary table
Values computed by the converter itself:
| Hexadecimal | Binary |
|---|---|
0 | 0 |
1 | 1 |
2 | 10 |
7 | 111 |
8 | 1000 |
A | 1010 |
F | 1111 |
10 | 10000 |
20 | 100000 |
40 | 1000000 |
64 | 1100100 |
7F | 1111111 |
FF | 11111111 |
100 | 100000000 |
3E8 | 1111101000 |
400 | 10000000000 |
1000 | 1000000000000 |
FFFF | 1111111111111111 |
Hexadecimal to binary in code
JavaScript
(parseInt('9C', 16)).toString(2); // '10011100'Python
format(int("9C", 16), "b") # '10011100'For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(2).
Frequently asked questions
Does it handle very large numbers?
Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.
Can I convert negative numbers or fractions?
Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).
Why do programmers use hexadecimal instead of binary?
Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.