Skip to content

Number Base Converter

Convert whole numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36. Works with very large and negative numbers and shows the division steps.

  • Free, no sign-up
  • Runs in your browser
  • Converters
Convert a whole number
A whole number, optionally negative. Prefixes 0b, 0o and 0x are accepted for bases 2, 8 and 16. Spaces and underscores can group digits, for example 1111_0000.

How to use the converter

Type a whole number, choose the base it is written in (From base) and the base you want (To base), then press Convert. The result card shows the number in binary, octal, decimal and hexadecimal at once, plus your chosen base if it is not one of those four. The details panel shows how the decimal value is turned into the target base by repeated division.

Input tips:

  • Letters stand for digits above 9: A = 10, B = 11, up to Z = 35. Upper or lower case is fine.
  • The prefixes 0b (binary), 0o (octal) and 0x (hexadecimal) are accepted when they match the selected base.
  • Spaces and underscores can group digits, for example 1111_0000 or 1 000 000.
  • A leading minus sign is allowed. Negative numbers are shown as a minus sign plus the converted size, not in two's complement.

There is no fixed size limit: the converter uses exact big-integer arithmetic, so numbers far beyond 64 bits convert without rounding. Input is limited to 1,000 digits.

How base conversion works

In base b, each position is worth b times the position to its right. To read a number into decimal, multiply each digit by its place value and add. For example, hexadecimal 7E8 is:

7×16² + 14×16¹ + 8×16⁰ = 1792 + 224 + 8 = 2024

To write a decimal number in another base, divide by the base again and again and keep the remainders.

Worked example: 2024 to binary

  1. 2024 ÷ 2 = 1012, remainder 0
  2. 1012 ÷ 2 = 506, remainder 0
  3. 506 ÷ 2 = 253, remainder 0
  4. 253 ÷ 2 = 126, remainder 1
  5. 126 ÷ 2 = 63, remainder 0
  6. 63 ÷ 2 = 31, remainder 1
  7. 31 ÷ 2 = 15, remainder 1
  8. 15 ÷ 2 = 7, remainder 1
  9. 7 ÷ 2 = 3, remainder 1
  10. 3 ÷ 2 = 1, remainder 1
  11. 1 ÷ 2 = 0, remainder 1

Reading the remainders from the last step to the first gives 11111101000. The same number is 3750 in octal and 7E8 in hexadecimal: 2024 ÷ 16 = 126 remainder 8, 126 ÷ 16 = 7 remainder 14 (E), 7 ÷ 16 = 0 remainder 7.

Good to know

  • Each hexadecimal digit stands for exactly four binary digits, and each octal digit for three, which is why programmers use them as short forms of binary.
  • The details panel shows at most 30 division steps; very long conversions continue the same way.
  • Only whole numbers are converted. Fractions such as 0.1 often have no finite form in other bases.
  • In base 16, 0b101 is read as the hexadecimal digits 0, B, 1, 0, 1, because B is a valid hex digit.

Frequently asked questions

How do I convert binary to hexadecimal quickly?

Split the binary digits into groups of four from the right and replace each group with one hex digit: 0000 = 0 up to 1111 = F. For example, 1010 1111 becomes AF. The converter does this for you when you choose base 2 as the source.

Why are letters used as digits?

Bases above 10 need more than ten digit symbols. By convention the letters A to Z stand for the values 10 to 35, which is why base 36 is the largest base that uses only digits and Latin letters.

How large a number can I convert?

The converter uses exact big-integer arithmetic, so there is no rounding at any size. The only limit is the input length of 1,000 digits, which in decimal is far more than any 64-bit or 128-bit integer.

How are negative numbers shown?

With a minus sign in front of the converted value, so -10 in decimal is -1010 in binary. Computers store negative integers in two's complement, which depends on a fixed bit width; this converter does not assume a width.