Number Base Converter

Type a number into any field and see it in binary, octal, decimal, hexadecimal and a custom base at once. Numbers of any size stay exact, with optional digit grouping and two’s complement for negatives.

100% freeNo sign-upRuns in your browserWorks on mobile

How to use the Number Base Converter

  1. Type or paste a number into whichever field matches its base: binary, octal, decimal or hexadecimal.
  2. Watch every other field update instantly. Prefixes such as 0x, 0b and 0o are accepted.
  3. Choose any base from 2 to 36 in the custom field, for example base 36 for short IDs.
  4. Tick Group digits to split long values into readable blocks, then copy any field; copied values leave out the grouping.

Features

  • Binary, octal, decimal and hexadecimal side by side
  • Any custom base from 2 to 36
  • Exact results for huge numbers using BigInt
  • Per-field validation that names the invalid digit
  • Optional digit grouping and uppercase hex
  • Bit length, byte count, smallest integer type and two’s complement

How positional number systems work

Every base uses the same idea: each digit is multiplied by a power of the base, depending on its position. In decimal (base 10), 255 means 2 × 10² + 5 × 10¹ + 5 × 10⁰. In binary (base 2), the only digits are 0 and 1, and each position is a power of two, so 11111111 is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255. Hexadecimal (base 16) needs sixteen digits, so it borrows the letters A to F for the values 10 to 15: FF is 15 × 16 + 15 = 255. Bases above 10 keep borrowing letters, which is why base 36 (0–9 plus A–Z) is the largest base that can be written with ordinary alphanumeric characters.

Converting by hand

To convert a decimal number to another base, divide repeatedly by the base and keep the remainders. For 45 in binary: 45 ÷ 2 = 22 remainder 1, 22 ÷ 2 = 11 r 0, 11 ÷ 2 = 5 r 1, 5 ÷ 2 = 2 r 1, 2 ÷ 2 = 1 r 0, 1 ÷ 2 = 0 r 1. Reading the remainders from the last to the first gives 101101. To go back, add up the powers of two where a 1 appears: 32 + 8 + 4 + 1 = 45.

Between binary and hexadecimal there is a shortcut, because 16 = 2⁴: every hex digit maps to exactly four bits. Split 1011 0110 into nibbles and read each one: 1011 is B and 0110 is 6, so the value is B6. Octal works the same way with groups of three bits, since 8 = 2³.

DecimalBinaryOctalHex
0000000
5010155
81000108
10101012A
12110014C
15111117F
161 00002010
2551111 1111377FF

Where each base shows up

  • Binary: bit flags, network masks and anything that describes individual on/off switches.
  • Octal: Unix file permissions, where each digit holds three permission bits; see the chmod calculator.
  • Hexadecimal: memory addresses, byte dumps, hashes and CSS colors such as #FF8800, where each pair of hex digits is one byte.
  • Base 36: compact identifiers such as short URLs, because it packs more value into fewer characters.

Prefixes and negative numbers

Programming languages mark the base with a prefix: 0b for binary, 0o for octal (or a bare leading zero in C and older JavaScript), and 0x for hexadecimal. This tool accepts those prefixes as you type. Negative numbers are shown with a minus sign, the mathematical convention. Computers usually store them in two’s complement, where -1 in 8 bits is FF; the tool shows that form in the smallest standard width that fits.

Why big numbers stay exact here

Ordinary JavaScript numbers are 64-bit floating point and can only represent whole numbers exactly up to 9,007,199,254,740,991 (2⁵³ − 1). Many online converters silently round anything larger, which corrupts 64-bit IDs and hashes. This converter uses BigInt arithmetic, so a 128-bit or even a 1,000-digit number converts without losing a single digit.

Mistakes to avoid

  • Reading a leading zero as decimal in languages where 010 means octal 8.
  • Confusing the letter O with zero, or lowercase l with one, when copying values by hand.
  • Forgetting that hex digits above 9 are letters: G or higher is never valid in base 16.

Frequently asked questions

How do I convert binary to decimal?

Multiply each bit by its power of two, starting from 1 on the right, and add the results. Or simply type the binary number into the Binary field and read the Decimal field.

Why does hexadecimal use letters?

Base 16 needs sixteen different digits, but we only have ten numerals, so A to F stand for the values 10 to 15.

Can I convert very large numbers?

Yes. The converter uses arbitrary-precision BigInt arithmetic, so numbers with hundreds of digits convert exactly without rounding.

Does it handle fractions or decimal points?

No. It converts whole numbers, including negative ones. Fractional values cannot always be written exactly in another base, so they are not supported.

What is the highest base I can use?

Base 36, which uses the digits 0–9 and the letters A–Z. Higher bases would need symbols beyond the standard alphanumeric set.

More developer tools

Other free tools you might need next.

View all 24