How to use the Number Base Converter
- Type or paste a number into the box for its base. Prefixes like
0band0x, spaces and underscores are fine. - Every other box updates instantly. Click Copy next to the one you need.
- Tick Signed (two's complement) and pick a bit width to see negative numbers the way computers store them.
- 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
| Decimal | Binary | Hex | Octal |
|---|---|---|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 8 | 10 |
| 9 | 1001 | 9 | 11 |
| 10 | 1010 | A | 12 |
| 11 | 1011 | B | 13 |
| 12 | 1100 | C | 14 |
| 13 | 1101 | D | 15 |
| 14 | 1110 | E | 16 |
| 15 | 1111 | F | 17 |
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.