Convert between every common number base
Computers store everything as binary, but programmers read and write numbers in several bases depending on context: decimal for everyday arithmetic, binary for bit-level work, octal for some file permissions and legacy protocol fields, and hexadecimal for memory addresses, colours, and byte dumps. This tool converts a value between all four bases in one step and includes a complete reference table for values 0 to 255 — one full byte.
How base conversion actually works
Any number written in base b is a weighted sum of its digits:
42 (decimal) = 4 × 10¹ + 2 × 10⁰
101010 (binary) = 1×2⁵ + 0×2⁴ + 1×2³ + 0×2² + 1×2¹ + 0×2⁰
= 32 + 0 + 8 + 0 + 2 + 0 = 42
To convert to a new base, repeatedly divide by the target base and read the remainders in reverse:
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
→ read upward: 101010
The converter applies this logic automatically and validates that every character you enter is a legal digit for the selected base — 9 is rejected in binary or octal, and G is rejected in hex.
Key relationships between the bases
The power of hex and octal comes from their clean relationship to binary:
- One hex digit = exactly four binary digits (one nibble). This is why hex is universally used for byte dumps: two hex digits always represent one byte exactly.
- One octal digit = exactly three binary digits. Unix file permissions use octal:
chmod 755sets rwx for owner (binary 111), r-x for group (binary 101), and r-x for others (binary 101).
These relationships make mental conversion fast once you recognise common patterns:
| Hex | Binary | Decimal | Common meaning |
|---|---|---|---|
| 0x00 | 00000000 | 0 | Null byte |
| 0x0F | 00001111 | 15 | Lower nibble mask |
| 0xFF | 11111111 | 255 | Max byte value; full opacity in CSS |
| 0x7F | 01111111 | 127 | Max signed 8-bit integer |
| 0x80 | 10000000 | 128 | Min signed 8-bit (two’s complement) |
Using the reference table
The table below the converter lists values 0 to 255 with columns for binary (padded to 8 digits), octal (padded to 3 digits), decimal, and hexadecimal (padded to 2 digits). Read across any row to translate between bases without arithmetic. This is particularly useful when mapping ASCII codes, RGB colour channel values, or IP address octets to their binary form.
All calculations run locally in your browser — no values you enter are sent anywhere.