Number base converter

Choose which number system to convert from and to, and type a number. You get the answer, the number in all four systems and how to work it out yourself. Even numbers with hundreds of digits are converted exactly.

Of
To

Whole numbers, even very large ones. A 0x, 0b or 0o prefix is fine; spaces are ignored.

Fill in the fields; the answer appears here straight away.

How it works

  1. Enter the values

    Type the numbers or the formula. Decimals may use a point or a comma. No idea? Click Fill in an example.

  2. Instant answer

    The answer appears as you type, with the most important intermediate values.

  3. See the working

    Under "How it's worked out" you see the steps, handy for checking your own calculation.

Four number systems

  • Decimal (10): our everyday system with the digits 0 to 9.
  • Binary (2): only 0 and 1. This is how computers count; every digit is a bit. 1111 1111 is 255.
  • Octal (8): the digits 0 to 7, used for example for file permissions in Linux (chmod 755).
  • Hexadecimal (16): 0–9 and A–F (A = 10 … F = 15). One hex digit is exactly 4 bits, so FF is 1111 1111. You know it from colour codes such as #FF8800.

Converting to decimal

Every digit is worth a power of the base. Binary 1011 = 1×8 + 0×4 + 1×2 + 1×1 = 11. Hexadecimal 2F = 2×16 + 15 = 47.

Converting decimal to binary

Keep dividing the number by 2 and write down the remainder, until you reach 0. Then read the remainders from bottom to top. 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1, so 13 is 1101 in binary. For octal and hexadecimal, divide by 8 or 16. A prefix such as 0x, 0b or 0o is fine, and spaces are ignored.

Four conversions in one table

Decimal Binary Octal Hexadecimal
10 1010 12 A
255 1111 1111 377 FF
2026 111 1110 1010 3752 7EA

Where you meet these bases

  • Linux permissions: chmod 755 is 111 101 101 in binary, three groups of three bits for read, write and execute.
  • Colours: #FF8800 is 255, 136 and 0 for red, green and blue. See the colour code converter.
  • Text as numbers: every character has a code, which you can see in binary or hex with text to binary and text to hexadecimal.

Grouping bits

Binary results are shown in groups of four bits, so they line up with hexadecimal digits: 0111 1110 1010 is 7, E and A. That makes it easy to check a conversion by eye.

Frequently asked questions

How do I convert binary to decimal?

Give every digit the value of a power of 2, from the right, and add the ones that are set. 1011 is 8 + 0 + 2 + 1 = 11. Type 1011 with *Binary* selected as the source to check it.

Why do programmers use hexadecimal?

One hex digit is exactly 4 bits, so a byte is always two hex digits and hex is a compact way to write binary. FF is 1111 1111, which is 255.

Can I convert fractions or negative numbers?

This converter handles whole numbers. Prefixes like 0x1F, 0b101 and 0o17 are accepted, and spaces are ignored.

How large can the number be?

There is no 64-bit limit. Numbers with hundreds of digits are converted exactly, because the calculation uses arbitrary-precision integers.