Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal and any base from 2 to 36 instantly, with arbitrary precision. All in your browser.

./number-base-converter
10
16
8
2
Base

Everything is computed in your browser; nothing is sent to any server.

What this tool does

You type a number into any of the fields — binary, octal, decimal, hexadecimal, or an arbitrary base between 2 and 36 — and the rest fill in instantly. There is no convert button: the fields are synced live, so you can type in whichever base comes naturally and read the answer in whichever one you need.

It runs entirely in your browser and uses BigInt, which means arbitrary precision: a two-hundred-digit number converts without losing a single digit. That is the practical difference against most converters, which operate on JavaScript’s Number type and start rounding silently past 2⁵³.

How to use it

  1. Type the number into the field for the base you already have.
  2. Read the result in the field for the base you want.
  3. For a base outside the usual four, set it in the custom base selector (2 to 36).

Digits above 9 are written as letters: a is 10, b is 11, and so on up to z, which is 35.

The four bases you meet in programming

Binary (base 2)

Two symbols, 0 and 1. It is how the hardware works underneath, and where you see it directly: permission masks, configuration flags, bitwise operations. When you type chmod 755 on Unix, each octal digit is describing three permission bits.

Octal (base 8)

Eight symbols, 0 through 7. Today it survives mostly in Unix file permissions, precisely because one octal digit is exactly three bits and permissions come in groups of three: read, write, execute.

Decimal (base 10)

The everyday one. It is the representation for humans, and the one used in anything that will be read by someone who is not looking at bits.

Hexadecimal (base 16)

Sixteen symbols: 09 and then af. It is the most useful base in programming for one concrete reason: each hex digit is exactly four bits, so a byte is always two digits and the mental conversion to binary is immediate. Hence its appearance in CSS colors (#ff6600), memory addresses, hex dumps, UUIDs and hashes.

The table worth memorizing

With these sixteen values you can translate hexadecimal to binary by eye, four bits at a time.

DecimalBinaryOctalHexadecimal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000108
91001119
10101012a
11101113b
12110014c
13110115d
14111016e
15111117f

How to convert by hand

From any base to decimal

Multiply each digit by the base raised to its position, counting from the right and starting at zero. For the binary 1011:

1×2³ + 0×2² + 1×2¹ + 1×2⁰
  8  +   0  +   2  +   1  = 11

From decimal to any base

Divide by the base repeatedly and write down the remainders. The number reads by joining the remainders from the bottom up. To take 11 to binary:

11 ÷ 2 = 5  remainder 1
 5 ÷ 2 = 2  remainder 1
 2 ÷ 2 = 1  remainder 0
 1 ÷ 2 = 0  remainder 1   →  1011

The shortcut between binary and hexadecimal

There is no need to go through decimal. Group the bits in fours from the right and translate each group with the table above:

1011 0110  →  b6

And the same in reverse. This shortcut is the reason hexadecimal won: it is readable binary.

The prefixes you will see in code

Most languages mark the base with a prefix on numeric literals:

  • 0b1011 — binary
  • 0o17 — octal (in older code it appears as a bare 017, a classic source of bugs)
  • 0xff — hexadecimal

It is worth remembering that 017 does not mean seventeen in C, Java or JavaScript: it means fifteen, because the leading zero declares it octal. It is a silent bug that turns up every so often in configuration constants.

About base 36

The ceiling of 36 is not arbitrary: it is what you can write with the ten digits plus the twenty-six letters of the Latin alphabet. That is why base 36 is the most compact way to represent an integer using only alphanumeric characters, and why it shows up in short-ID generators and URL shorteners, where every saved character counts.

Frequently asked questions

How do I convert binary to decimal?

Type the number into the binary field and every other base updates on its own. By hand, multiply each digit by 2 raised to its position counting from the right starting at zero, then add the results. For example 1011 is 8 + 0 + 2 + 1, which is 11.

Is there a size limit on the number?

Not in practice. The tool uses BigInt, so it works with arbitrary precision and does not drop digits on huge numbers. That is the difference from converting with JavaScript's Number type, which starts rounding above 2^53.

Which bases does it support beyond the usual four?

Any base from 2 to 36. The ceiling is 36 because that exhausts the symbols available using the ten digits plus the twenty-six letters of the Latin alphabet. Base 36 is the most compact representation writable in alphanumeric characters.

Does it convert negative or fractional numbers?

It works with integers. Fractional and negative values are out of scope because their representation in other bases depends on conventions (two's complement, IEEE 754 floating point) that vary by context and would give a misleading result without stating which one was applied.

Why is hexadecimal used so much in programming?

Because each hex digit maps to exactly four bits, so a byte is always two digits and translating to binary in your head is direct. That makes it ideal for colours, memory addresses, dumps and bitmasks, where you want to see the bit pattern without writing eight zeros and ones.

Reviews & ratings

No reviews yet. Be the first to leave one!

Write a review

Your rating *