Math Calculators

Number Base Converter

Convert numbers between binary, octal, decimal, hex and other bases.

—Binary
—Octal
—Decimal
—Hexadecimal
—Base 5

Working

What is a number base?

A number base (or radix) is how many different digits a number system uses. We count in base 10 (decimal), with the digits 0 to 9. Computers work in base 2 (binary), with only 0 and 1. Programmers also use base 16 (hexadecimal), with 0–9 and A–F, and base 8 (octal), with 0–7, because they are compact ways to write binary. This converter switches any whole number between these systems and any base up to 36.

How to use the converter

  1. Type the number. Prefixes such as 0x for hex and 0b for binary are accepted.
  2. Select the base it is written in.
  3. Read the result in binary, octal, decimal, hex and an extra base of your choice. The working shows how the conversion is done.

How conversion works

Any base to decimal

Each digit is worth its value times the base raised to its position, counting from 0 on the right:

FF (hex) = 15 × 16¹ + 15 × 16⁰ = 240 + 15 = 255
1101 (binary) = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13

Decimal to any base

Divide repeatedly by the base and write down the remainders. Reading the remainders from the last to the first gives the answer. For 13 in binary: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1, giving 1101.

Quick reference

DecimalBinaryOctalHex
81000108
10101012A
15111117F
16100002010
25511111111377FF
1024100000000002000400

Each hex digit equals exactly 4 binary digits, and each octal digit equals 3, which is why programmers use them as shorthand for binary.

Frequently asked questions

How big a number can I convert?

There is no practical limit. The tool uses JavaScript BigInt, so numbers with hundreds of digits convert exactly.

Does it convert fractions?

No, only whole numbers (including negative ones).

How do I convert text into binary?

Use the Text to Binary Converter, which converts letters rather than numbers.