How to convert between number bases
- 1.
Enter a number
E.g. 255, -42, 0.625, FF, 0x1F or 0b1011. Spaces and underscores are ignored, so 1111_0000 works too.
- 2.
Choose the source base
Binary, octal, decimal, hexadecimal or “other” for any base from 2 to 36.
- 3.
Choose the target base
The result appears at the top; the number in all four common bases is listed below.
- 4.
Check the steps
See the repeated division, the positional expansion and the two’s complement form on 8, 16 and 32 bits.
Decimal to another base: repeated division
Divide by the target base with remainder until the quotient is 0, then read the remainders from bottom to top. For 11 in binary: 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1, so 11₁₀ = 1011₂. Likewise 255₁₀ = 11111111₂ = 377₈ = FF₁₆.
For the fractional part multiply by the base instead and take the integer part of each product as the next digit: 0.625 × 2 = 1.25 → 1, 0.25 × 2 = 0.5 → 0, 0.5 × 2 = 1.0 → 1, so 0.625₁₀ = 0.101₂. The converter shows up to 24 fractional digits and marks a cut-off result with “…”.
Another base to decimal: positional expansion
Multiply each digit by the base raised to its position (counting from 0 at the right of the point) and add: 1011₂ = 1·2³ + 0·2² + 1·2¹ + 1·2⁰ = 8 + 0 + 2 + 1 = 11. Fractional digits use negative powers: A.8₁₆ = 10·16⁰ + 8·16⁻¹ = 10.5.
Bases above 10 use letters as digits: A = 10, B = 11 … Z = 35, so base 36 uses all of 0-9 and A-Z. Letter case does not matter. If you type a digit that does not exist in the chosen base (e.g. 2 in binary), the converter tells you which digits are allowed.
Quick reference table
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 1 0000 | 20 | 10 |
| 100 | 110 0100 | 144 | 64 |
| 255 | 1111 1111 | 377 | FF |
| 1024 | 100 0000 0000 | 2000 | 400 |
Shortcut: one hex digit is exactly 4 bits and one octal digit is 3 bits, so you can convert binary to hex by splitting into groups of four from the right (1010 1111 = AF). That is why the converter groups binary and hex digits by 4. Roman numerals are not a positional system - use the Roman numerals converter for those.
Two’s complement
Processors store signed integers in two’s complement: −x on n bits equals 2ⁿ − x. By hand: write |x| in binary, invert the bits and add 1: −5 → 00000101 → 11111010 → 11111011 (FB in hex). The ranges are −128…127 on 8 bits, −32,768…32,767 on 16 bits and about ±2.1 billion on 32 bits; outside them the tool shows “out of range”.
It also works backwards: enter a binary or hex pattern such as FF and the table shows what it means as a signed number (−1 on 8 bits, 255 on 16 bits). Two’s complement applies to integers only.
Frequently asked questions
How do I convert decimal to binary?
+
What is FF in decimal?
+
How do I convert hex to binary?
+
What do the letters in hexadecimal mean?
+
How do I write a negative number in two’s complement?
+
Why does 0.1 never end in binary?
+
Can I convert very large numbers?
+
Updated: