Computers only understand zeros and ones, but we humans find decimal more convenient, and programmers prefer hexadecimal. Here you have a converter and a simple explanation of how each system works and how to go from one to another by hand.
In short
- Binary (base 2): only 0 and 1. It’s what the hardware uses.
- Hexadecimal (base 16): 0–9 and A–F. Each digit equals exactly 4 bits.
- A byte is 8 bits: 0 to 255 in decimal, 00 to FF in hexadecimal.
Converter
Type in any field and the others update. It handles large numbers.
How a number base works
In decimal, each position is worth 10 times more than the one to its right: in 352, the 3 is worth 300, the 5 is worth 50 and the 2 is worth 2.

The other bases work the same way; only the multiplier changes:
| Base | Digits | Value of each position (right to left) |
|---|---|---|
| 2 (binary) | 0 1 | 1, 2, 4, 8, 16, 32, 64, 128… |
| 8 (octal) | 0–7 | 1, 8, 64, 512… |
| 10 (decimal) | 0–9 | 1, 10, 100, 1,000… |
| 16 (hexadecimal) | 0–9, A–F | 1, 16, 256, 4,096… |
In hexadecimal, A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15.
Converting by hand
From binary to decimal
Add up the value of each position that has a 1. For 1011 0110:
128 64 32 16 8 4 2 1
1 0 1 1 0 1 1 0
128 + 32 + 16 + 4 + 2 = 182

From decimal to binary
Divide by 2 over and over and write down the remainders; they’re read from bottom to top. For 13:
13 / 2 = 6 remainder 1
6 / 2 = 3 remainder 0
3 / 2 = 1 remainder 1
1 / 2 = 0 remainder 1
→ 1101
From binary to hexadecimal (the 4-bit trick)
Group the bits in fours starting from the right and convert each group:
1011 0110
B 6 → 0xB6

That’s why hexadecimal is so handy: a byte is always two hexadecimal digits.
Where you’ll see them
| Where | Example | What it means |
|---|---|---|
| Web colors | #0A66B8 | Red 0A (10), green 66 (102), blue B8 (184) |
| MAC address | 3C:22:FB:1A:09:7E | 6 bytes in hexadecimal |
| IPv4 address | 192.168.1.1 | 4 bytes written in decimal |
| IPv6 address | fe80::1 | 16 bytes in hexadecimal |
| I2C addresses | 0x27 | The module at 39 in decimal |
| Linux permissions | chmod 755 | Octal: rwx r-x r-x |
Prefixes that indicate the base
To avoid confusing 10 in decimal with 10 in binary, programming uses prefixes:
0b1010→ binary (10 in decimal).0x1A→ hexadecimal (26 in decimal).0o17or017→ octal (15 in decimal).
Common mistakes
- Confusing the letter O with zero in hexadecimal: the valid digits are 0–9 and A–F.
- Forgetting the reading order when converting from decimal to binary: the remainders are read from bottom to top.
- Thinking colors go from 0 to 100: each channel goes from 00 to FF, that is, from 0 to 255.
- Miscounting bits: 8 bits = 1 byte; 4 bits = 1 hexadecimal digit (a nibble).



