Converter

Conversion mode

Enter or Ctrl + Enter converts. Escape clears the input.

Conversion History

No conversions yet. Your recent conversions are saved in this browser only.

How number bases work

What is a number system?

A number system is a way of writing numbers using a fixed set of digits. The base (or radix) is how many different digits it has. Each position in a number is worth a power of the base, so the same digits mean different things in different bases.

Binary number system

Base 2

Digits: 0 and 1. Computers use it because a circuit is either off or on.

11012 = 8 + 4 + 0 + 1 = 1310

Octal number system

Base 8

Digits: 0 to 7. Each octal digit stands for exactly three binary digits.

3778 = 192 + 56 + 7 = 25510

Decimal number system

Base 10

Digits: 0 to 9. This is the system we use every day.

24510 = 2×100 + 4×10 + 5×1

Hexadecimal number system

Base 16

Digits: 0 to 9 and A to F (A = 10 … F = 15). Each hex digit stands for four binary digits.

2D16 = 2×16 + 13 = 4510

Integer conversion: repeated division

To convert a whole number from decimal to another base, divide by the target base again and again. Write down each remainder, then read the remainders from the last one to the first.

Example: 4510 to binary.

DivisionQuotientRemainder
45 ÷ 2221
22 ÷ 2110
11 ÷ 251
5 ÷ 221
2 ÷ 210
1 ÷ 201

Reading the remainders from bottom to top gives 4510 = 1011012. For hexadecimal, divide by 16 and write remainders 10 to 15 as A to F: 255 ÷ 16 = 15 remainder 15, then 15 ÷ 16 = 0 remainder 15, so 25510 = FF16.

Fractional conversion: repeated multiplication

To convert the part after the point, multiply it by the target base. The whole-number part of the answer is the next digit. Keep only the fractional part and repeat until it becomes 0 or you reach the precision you want. Read the digits from top to bottom.

Example: 0.62510 to binary.

MultiplicationResultDigit
0.625 × 21.251
0.25 × 20.50
0.5 × 21.01

The fraction reached 0, so 0.62510 = 0.1012. Put it together with the integer part and 45.62510 = 101101.1012.

Some fractions never reach 0. For example, 0.110 in binary repeats as 0.0001100110011… forever. That is why the converter has a fractional precision setting: it stops after that many digits and marks the result as truncated.

Converting to decimal: place values

Going the other way, multiply each digit by its place value. Digits after the point have negative powers of the base.

101.1012 = 1×2² + 0×2¹ + 1×2⁰ + 1×2⁻¹ + 0×2⁻² + 1×2⁻³ = 4 + 0 + 1 + 0.5 + 0 + 0.125 = 5.62510