Number Base Converter
Convert between binary, octal, decimal, and hexadecimal.
Converted across all common bases below.
| Base | Value |
|---|---|
| Binary | 11111111 |
| Octal | 377 |
| Decimal | 255 |
| Hexadecimal | FF |
To convert a number between bases, divide it repeatedly by the target base and read the remainders from bottom to top. Binary is base 2, octal base 8, decimal base 10, and hexadecimal base 16. For example, decimal 156 is 10011100 in binary, 234 in octal, and 9C in hex.
How positional bases work
In any base, each digit position is worth the base raised to a power, counting from zero on the right. We count in base 10, so 372 means 3×10² + 7×10¹ + 2×10⁰. Binary (base 2) works the same way with powers of two, octal with powers of eight, and hexadecimal with powers of sixteen — the only difference is the base you raise.
The four bases at a glance
Same value, four notations.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
Worked example: decimal 156 to binary
The repeated-division method divides by the target base and records the remainders, then reads them bottom to top.
- 1 Divide by 2, note the remainder. 156 ÷ 2 = 78 r0, 78 ÷ 2 = 39 r0, 39 ÷ 2 = 19 r1, 19 ÷ 2 = 9 r1.
- 2 Keep going until the quotient is 0. 9 ÷ 2 = 4 r1, 4 ÷ 2 = 2 r0, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1.
- 3 Read the remainders bottom to top. 10011100 — so 156 in decimal is 10011100 in binary.
- 4 Check by place value. 128 + 16 + 8 + 4 = 156. Confirmed.
Reading hexadecimal
Hex uses the digits 0–9 then A–F for ten through fifteen. One hex digit maps to exactly four binary bits (a nibble), so any byte fits in two hex digits — which is why colors (#FF8800), memory addresses, and byte dumps are written in hex. For older notations, the Roman numeral converter handles the pre-positional system, and the scientific notation converter covers very large decimal values.
One hex digit = four bits
Group binary in fours from the right, then translate each group.
| Binary | Hex | Decimal |
|---|---|---|
| 0000 | 0 | 0 |
| 0101 | 5 | 5 |
| 1001 | 9 | 9 |
| 1100 | C | 12 |
| 1111 | F | 15 |