Base Converter (Binary, Octal, Decimal, Hexadecimal)

A number base, sometimes called a radix, is simply how many distinct digits a counting system uses before it rolls over into the next place value. The decimal system we use every day is base 10, with the ten digits 0 to 9. Computers, on the other hand, work most naturally in binary, which is base 2 and uses only 0 and 1, while programmers often lean on octal (base 8) and hexadecimal (base 16) as compact ways to write the same binary values. This converter lets you move a whole number freely between all four of those systems. Enter your number as a string of digits, tell the converter which base it is currently written in, and it instantly shows you the equivalent in binary, octal, decimal and hexadecimal. Before converting, it checks that the digits you typed are actually valid for the base you chose, so a binary number can only contain 0 and 1, an octal number only 0 to 7, a decimal number only 0 to 9, and a hexadecimal number the digits 0 to 9 plus the letters A to F. If anything is out of range, you get a clear message rather than a silent wrong answer. Under the hood the tool reads your input in its source base, turns it into a plain numeric value, and then re-expresses that value in each target base. Hexadecimal output is shown in uppercase by convention. It is built for students learning number systems, programmers and electronics hobbyists reading memory addresses or colour codes, and anyone who needs a fast, dependable conversion. Results are reliable for whole numbers up to two to the power of 53.

Advertisement
Decimal
255
Binary11111111
Octal377
HexadecimalFF

The formula

To read a number written in a given base, each digit is multiplied by the base raised to the power of its position, counting from zero on the right, and the results are added together. To write that value in a new base, you repeatedly divide by the new base and read the remainders. The converter reads your input in its source base to get a plain value, then expresses that value in each target base.

value = dₙ × baseⁿ + ... + d₁ × base¹ + d₀ × base⁰

Valid digits: binary 0 to 1, octal 0 to 7, decimal 0 to 9, hexadecimal 0 to 9 and A to F.

Worked example

Take the decimal number 255. In binary it is 11111111, because 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. In octal it is 377, and in hexadecimal it is FF, since 15 × 16 + 15 = 255. All four are different ways of writing the same value.

Who this calculator is for

This calculator is for students learning number systems, programmers and electronics hobbyists working with memory addresses, bit masks or colour codes, and anyone who needs a quick, validated conversion between binary, octal, decimal and hexadecimal.

What this calculator assumes

  • You enter a whole, non-negative number written in the base you select.
  • The digits you enter are valid for that base; invalid digits show a message.
  • Hexadecimal output is shown in uppercase.
  • Results are reliable for integers up to two to the power of 53.

Frequently asked questions

What is a number base?

A number base, also called a radix, is the number of distinct digits a system uses to represent values. Decimal is base 10 and uses the digits 0 to 9. Binary is base 2 and uses only 0 and 1. Octal is base 8 and hexadecimal is base 16, which adds the letters A to F to represent the values 10 to 15.

How do I convert binary to decimal?

Each binary digit represents a power of two, doubling from right to left: 1, 2, 4, 8, 16 and so on. Add up the place values where the digit is 1. For example 1111 1111 in binary is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1, which is 255 in decimal.

Why does hexadecimal use letters?

Hexadecimal is base 16, so it needs sixteen distinct digits. The digits 0 to 9 cover the first ten values, and the letters A, B, C, D, E and F represent the values 10, 11, 12, 13, 14 and 15. This lets a single character stand for four binary digits, which is why hexadecimal is common in computing.

What is the largest number this converter handles?

Results are reliable for whole numbers up to two to the power of 53, which is the largest integer that can be represented exactly. Above that, rounding can make a conversion inaccurate.

Related calculators