Binary and hexadecimal
Binary (base 2) is how hardware stores every number: each digit is a bit, worth a power of 2. 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.
Hex is the compact way to write binary: every 4 bits become one digit, so long bit strings from protocols and datasheets become readable.
This page opens the base converter with binary 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.
Binary vs hexadecimal
| Binary | hexadecimal | |
|---|---|---|
| Base | 2 | 16 |
| Digits | 0 1 | 0–9 A–F |
| Prefix in code | 0b | 0x |
| 255 is written | 11111111 | FF |
How to convert binary to hexadecimal 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).
Binary to hexadecimal table
Values computed by the converter itself:
| Binary | Hexadecimal |
|---|---|
0 | 0 |
1 | 1 |
10 | 2 |
111 | 7 |
1000 | 8 |
1010 | A |
1111 | F |
10000 | 10 |
100000 | 20 |
1000000 | 40 |
1100100 | 64 |
1111111 | 7F |
11111111 | FF |
100000000 | 100 |
1111101000 | 3E8 |
10000000000 | 400 |
1000000000000 | 1000 |
1111111111111111 | FFFF |
Binary to hexadecimal in code
JavaScript
(parseInt('10011100', 2)).toString(16); // '9c'Python
format(int("10011100", 2), "X") # '9C'For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(16).
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.