curly{bits}

curlybits / Base Converter

Number Base Converter

Type a number in any box, and it's converted to all the others as you type: binary, octal, decimal, hexadecimal, or any base from 2 to 36. Works with numbers of any size, shows two's complement for negative values, and explains every step.

How it's converted

How to use the Number Base Converter

  1. Type or paste a number into the box for its base. Prefixes like 0b and 0x, spaces and underscores are fine.
  2. Every other box updates instantly. Click Copy next to the one you need.
  3. Tick Signed (two's complement) and pick a bit width to see negative numbers the way computers store them.
  4. Open How it works to see the conversion worked out step by step.

How number bases work

A number base says how many different digits there are. Decimal (base 10) uses 0–9. Binary (base 2) uses only 0 and 1, which is how computers store everything. Hexadecimal (base 16) uses 0–9 and A–F, and is a compact way to write binary: every hex digit is exactly four bits. Octal (base 8) uses 0–7 and still appears in Unix file permissions like 755.

In every base, each position is worth the base raised to a power. In decimal, 345 means 3×10² + 4×10¹ + 5×10⁰. In binary, 1011 means 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11.

The first 16 numbers in each base

DecimalBinaryHexOctal
0000000
1000111
2001022
3001133
4010044
5010155
6011066
7011177
81000810
91001911
101010A12
111011B13
121100C14
131101D15
141110E16
151111F17

Two's complement

Computers store negative integers using two's complement: in an 8-bit byte, 11111111 means −1 and 10000000 means −128. Tick Signed (two's complement) and choose 8, 16, 32 or 64 bits. Typing -5 in decimal then shows 1111 1011 in 8-bit binary and FB in hex, and typing a binary or hex pattern shows its signed value.

Very large numbers

Many converters lose accuracy above 253 (about 9 quadrillion) because they use ordinary JavaScript numbers. This one uses arbitrary-precision integers, so 64-bit IDs, hashes and huge values convert exactly.

Frequently asked questions

How do I convert binary to decimal?

Multiply each binary digit by 2 raised to its position, counting from 0 on the right, and add the results. 1011 = 8 + 0 + 2 + 1 = 11. Type it above and open How it works to see every step.

How do I convert decimal to binary?

Divide the number by 2 repeatedly and write down the remainders, then read them from the last to the first. 11 → remainders 1, 1, 0, 1 → 1011.

What do 0x and 0b mean?

They're prefixes programmers use to show the base: 0x for hexadecimal, 0b for binary and 0o for octal. You can paste numbers with or without them.

Does it support fractions?

No, whole numbers only, positive or negative, of any size.

Can I use other bases?

Yes. The last box converts to and from any base from 2 to 36, using the digits 0–9 and then the letters A–Z.

Add this number base converter to your website

Free for blogs, schools and businesses. Copy the code below and paste it into your page's HTML. The tool works exactly like this one and runs in your visitors' browsers, so nothing is uploaded. Please keep the credit line so others can find it too.

Preview embed ↗