Skip to content

Number Base Converter: Binary, Hex, Decimal & Octal

A number base converter changes numbers between binary, decimal, octal, hexadecimal, or any base from 2 to 36. It shows the exact conversion as you type.

Number Base Converter

Conversion happens automatically as you type

Loading calculator...
📚

Documentation

Number Base Converter

A number base converter changes how a number is written, from one positional numeral system to another, without changing its value. It can turn binary into decimal, decimal into hexadecimal, or convert between any two bases from 2 to 36.

What is a number base?

A number base, also called a radix, is the count of different digits a system uses before it starts repeating them in a new position. Decimal, the system used for everyday counting, is base 10. It uses ten digits, 0 through 9. Binary is base 2 and uses only 0 and 1. Once a base goes above 10, letters stand in for the missing digits: A represents 10, B represents 11, and so on up to Z, which represents 35. This lets a system reach base 36, the highest base most converters support, using only the 26 letters of the alphabet plus the 10 digits.

Each digit in a number has a place value based on powers of the base. In decimal, the number written as "205" means 2 hundreds, 0 tens, and 5 ones, because 100 and 10 are powers of 10. The same idea applies in any base: the digit farthest right is multiplied by base⁰, the next by base¹, the next by base², and so on.

How to convert a number to another base

Converting a number to decimal

To turn a number in any base into decimal, multiply each digit by the base raised to its position, counting from 0 on the right, then add the results together.

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

Example: Convert the base-5 number 101 to decimal.

  • (1 × 5²) + (0 × 5¹) + (1 × 5⁰)
  • = 25 + 0 + 1
  • = 26

So 101 in base 5 equals 26 in decimal.

Converting decimal to another base

To turn a decimal number into another base, divide it by the target base repeatedly and keep each remainder. Stop when the number reaches 0, then read the remainders from the last one found back to the first.

Example: Convert decimal 26 to base 5.

  • 26 ÷ 5 = 5, remainder 1
  • 5 ÷ 5 = 1, remainder 0
  • 1 ÷ 5 = 0, remainder 1
  • Reading the remainders bottom to top: 101

This confirms the earlier example: 26 in decimal is 101 in base 5.

Worked examples

Binary to decimal: The binary number 1101 converts to decimal like this: (1×2³) + (1×2²) + (0×2¹) + (1×2⁰) = 8 + 4 + 0 + 1 = 13.

Decimal to hexadecimal: The decimal number 202 converts to hexadecimal like this: 202 ÷ 16 = 12 remainder 10, then 12 ÷ 16 = 0 remainder 12. In hexadecimal, 10 is written A and 12 is written C. Reading the remainders bottom to top gives CA. So 202 in decimal is CA in hexadecimal.

Octal to binary: The octal number 17 first converts to decimal: (1×8¹) + (7×8⁰) = 15. Decimal 15 then converts to binary as 1111. So 17 in octal equals 1111 in binary.

Common number bases

BaseNameDigits usedWhere it is used
2Binary0–1How computers store and process data
8Octal0–7Unix and Linux file permission codes
10Decimal0–9Everyday counting
16Hexadecimal0–9, A–FMemory addresses, color codes on the web
36Base-360–9, A–ZShort web IDs and compact codes

Very large numbers

Some conversions involve numbers too large for standard double-precision math to handle exactly, such as a 64-bit hexadecimal value like FFFFFFFFFFFFFFFF. This converter works with whole numbers of any size using arbitrary-precision integer arithmetic, so it does not round or lose digits on long values.

Frequently asked questions

What is the difference between binary and hexadecimal?

Binary uses only two digits, 0 and 1. Hexadecimal uses sixteen, 0 through 9 and A through F. Because 16 is 2⁴, each single hexadecimal digit stands for exactly four binary digits, which is why hexadecimal is often used as a short way to write out binary values.

How do you convert decimal to binary by hand?

Divide the decimal number by 2 repeatedly and record each remainder. Read the remainders in reverse order, from the last division to the first. For example, 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1. Reading bottom to top gives 1101, which is 13 in binary.

What is the largest base this tool supports?

The tool supports bases from 2 to 36. Base 36 is the highest base reachable using only the ten digits 0-9 and the twenty-six letters A-Z, since that gives exactly 36 distinct symbols.

Can this tool convert negative numbers?

No. It works with positive whole numbers only. To convert a negative number, convert its absolute value and then add a minus sign to the result by hand.

Why do hexadecimal and octal exist if computers use binary internally?

Long strings of 1s and 0s are hard for people to read and easy to miscount. Because 16 and 8 are both powers of 2, hexadecimal and octal digits map cleanly onto fixed groups of binary digits, four bits for hex and three bits for octal. This makes long binary values shorter and easier to check by eye.

Is there a limit to how large a number this tool can convert?

No practical limit. The tool uses arbitrary-precision arithmetic rather than standard floating-point numbers, so it converts very long values, including ones larger than what a typical calculator can represent exactly, without rounding errors.