How to use the number base converter
- Type the value in Number. You may include a minus sign and one point, such as 0.1 or -1A.F.
- Set From base, the base the number is written in (2 to 36).
- Set To base, the base you want. The swap button next to the base fields reverses the direction.
- Read the converted value at the top, and the In common bases table for binary (in groups of 4), octal, decimal, hex and base 36.
What it does and when to use it
Computers store numbers in binary, programmers write them in hex, and maths courses ask for conversions between any two bases. Most converters only handle whole numbers. This one also converts fractions exactly and shows when a fraction repeats in the new base, which is the key to understanding floating-point rounding.
For arithmetic directly in base 2, use the binary calculator. To write a repeating decimal as a fraction, try the decimal to fraction converter. The scientific notation converter handles powers of ten.
How it works
The input is read digit by digit into an exact fraction: each digit is worth a power of the From base. For example, 777 in base 8 is 7 × 64 + 7 × 8 + 7 = 511.
To write the value in the new base:
- Whole part: divide by the base again and again; the remainders, read from last to first, are the digits.
- Fractional part: multiply by the base again and again; the whole-number part of each product is the next digit. If a remainder comes back that was seen before, the digits from that point repeat, and the tool puts them in brackets.
Step by step: 0.1 (base 10) to base 2.
| Step | Multiply by 2 | Digit | Left over |
|---|---|---|---|
| 1 | 0.1 × 2 = 0.2 | 0 | 0.2 |
| 2 | 0.2 × 2 = 0.4 | 0 | 0.4 |
| 3 | 0.4 × 2 = 0.8 | 0 | 0.8 |
| 4 | 0.8 × 2 = 1.6 | 1 | 0.6 |
| 5 | 0.6 × 2 = 1.2 | 1 | 0.2 |
At step 5 the left-over 0.2 has been seen before (after step 1), so digits 2 to 5 repeat: 0.0(0011).
For a whole number, 255 to hex: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F). Reading the remainders upward gives FF.
Worked examples
A decimal fraction in binary. 0.1 (base 10) in base 2: 0.0(0011). The table also shows 0.1(9) in hex.
Decimal to hex. 255 (base 10) in base 16: FF, which is 1111 1111 in binary.
Octal to decimal. 777 (base 8) in base 10: 511.
A negative number. -5 converts to -101 in binary, and the two’s complement table shows 8-bit | 1111 1011.
Limits and tips
- Bases must be whole numbers from 2 to 36.
- Only one point is allowed; commas are not accepted as separators.
- Conversions run in your browser, with nothing uploaded.
Frequently asked questions
What do the brackets in 0.0(0011) mean?
Which digits can I use above base 10?
Can I paste 0x, 0b or 0o prefixes?
How are negative numbers handled?
How many fractional digits are shown?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.