Number base converter.

The number base converter turns a whole number from any base between 2 and 36 into any other, including binary, octal, decimal, and hexadecimal. Decimal 255 is 11111111 in binary, 377 in octal, and FF in hex. Results stay exact even with hundreds of digits, and the repeated-division steps appear below each conversion.

Updated Typed values never leave your browser

Convert between bases

Bases 2 to 36, signed integers, no loss of precision even with hundreds of digits.

From
To
Tab next field. Everything runs in your browser, nothing is sent.
Base 10 to 2calterix
11111111
255 (base 10) = 11111111 (base 2)
  • Binary11111111
  • Octal377
  • Decimal255
  • HexadecimalFF
Repeated division by 2 (read the remainders from bottom to top)
255 ÷ 2 = 127, remainder 1
127 ÷ 2 = 63, remainder 1
63 ÷ 2 = 31, remainder 1
31 ÷ 2 = 15, remainder 1
15 ÷ 2 = 7, remainder 1
7 ÷ 2 = 3, remainder 1
3 ÷ 2 = 1, remainder 1
1 ÷ 2 = 0, remainder 1

How to convert between bases

To go from decimal to another base, divide by the target base until the quotient hits zero. The remainders, read from bottom to top, spell the answer. To go the other way, multiply each digit by the base raised to its position and add everything up.

13 ÷ 2 = 6 remainder 1
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1
Remainders from bottom to top: 1101, so 13 is 1101 in binary

In hexadecimal, the digits 10 through 15 are written A through F. In larger bases the letters continue up to Z, which stands for 35 in base 36.

Binary, octal, and hex equivalents

DecimalBinaryOctalHexadecimal
10101012A
15111117F
16100002010
100110010014464
25511111111377FF
1000111110100017503E8
40961000000000000100001000

Hex is common in web colors and memory addresses, and binary shows the bits inside a byte. One hex digit always maps to exactly 4 binary digits.

Precision, signs, and fractions

  • Precision: the tool works with arbitrary-size integers, so a number like 2^100 converts exactly, with no rounding.
  • Signs: a minus sign in front is kept, so −255 becomes −FF.
  • Prefixes: 0x, 0b, and 0o are accepted at the start of the number.
  • Fractions: not converted. Whole numbers only, because exact fraction conversion between bases can repeat forever.
Use the swap button to flip the two bases, and the four-base view to see binary, octal, decimal, and hex for the same number at once.

Looking for file sizes in bytes, KB, or GB? Use the unit converter. For another number system, try Roman numerals.

Frequently asked questions

How do I convert decimal to binary?

Divide the number by 2 over and over and write down each remainder. Read the remainders from bottom to top: 13 becomes 1101.

How do I convert hex to decimal?

Multiply each digit by 16 raised to its position and add the results. FF is 15 × 16 + 15 = 255.

What is the largest base the converter supports?

Base 36, which uses the digits 0 to 9 and the letters A to Z. The letter Z stands for 35.

Does the converter lose precision with big numbers?

No. Integers of any practical size convert exactly, with no floating-point rounding.

Can I convert a number with a decimal point?

No. Only whole numbers are converted, since fractions can turn into endless repeating digits in another base.

Sources and method

Standard public-domain formulas. Every calculation is checked against independent numeric tests before it goes live.