Number Base Converter
Binary, octal, decimal, hex and every base up to 36.
Runs entirely in your browser
Loading the tool…
| Decimal | — |
|---|---|
| Hexadecimal | — |
| Octal | — |
| Binary | — |
| Base 32 | — |
| Base 36 | — |
- —Bits
- —Bytes
- —Fits in
- —Parity
Any base from 2 to 36
Type a number in any base from 2 to 36 and read it back in all the others. Binary is grouped into bytes so long strings stay readable, and the panel shows how many bits the value needs and which fixed-width integer would hold it, which are the questions that usually prompted the conversion in the first place.
Prefixes and separators are accepted, so 0xFF, 1010 1010
and 1_000_000 all parse. Values up to 128 bits are supported; beyond that
the tool says so rather than silently wrapping around.
How to use it
- Enter your number and pick the base it is written in.
- Read the equivalents: decimal, binary, octal, hex and more.
- Use the custom base selector for anything unusual, up to base 36.
Questions
Why does hexadecimal use letters?
Hex is base 16, so it needs sixteen digit symbols. After 0-9 it borrows a-f for the values ten to fifteen. One hex digit is exactly four bits, which is why a byte is always two hex digits.
What is the 0x prefix for?
It is a convention telling a human or a compiler that what follows is hexadecimal, while 0b marks binary and 0o marks octal. They are not part of the number, and this tool strips them for you.
Can it convert negative or fractional numbers?
Not currently: it handles whole non-negative numbers up to 128 bits. Negative values depend on a representation choice (two's complement and its width) that a general converter cannot guess.
Why does everything use hexadecimal rather than plain binary?
Because one hex digit is exactly four bits, so the conversion is mechanical and a byte is always two characters. A 32-bit value is eight hex digits, an IPv6 group is four, a colour is six. Binary says the same thing four times longer, and people miscount long runs of ones and zeros.
How are negative numbers stored?
In two's complement: flip every bit of the magnitude and add one, and the top bit ends up meaning negative. It exists so that hardware can add signed and unsigned numbers with the same circuit. This converter works on non-negative whole numbers, up to 128 bits of them, so a negative input is rejected rather than silently wrapped.
What is the largest whole number JavaScript can hold exactly?
9007199254740991, which is 2^53 minus 1, because numbers are IEEE 754 doubles with 53 bits of precision. Past it, integers start rounding to even and two different values can compare as equal. It is the reason APIs send large IDs as strings, and the reason BigInt exists.
Is base 32 here the same as Base32 encoding?
No, and it is worth keeping them apart. This page does arithmetic base conversion, so base 32 uses 0 to 9 then a to v, and base 36 continues to z. RFC 4648 Base32, the one that appears in TOTP secrets and onion addresses, uses A to Z and 2 to 7 and encodes bytes rather than numbers.
Counting in four bases
| Decimal | Binary | Octal | Hex | Decimal | Binary | Octal | Hex |
|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 8 | 1000 | 10 | 8 |
1 | 1 | 1 | 1 | 9 | 1001 | 11 | 9 |
2 | 10 | 2 | 2 | 10 | 1010 | 12 | a |
3 | 11 | 3 | 3 | 11 | 1011 | 13 | b |
4 | 100 | 4 | 4 | 12 | 1100 | 14 | c |
5 | 101 | 5 | 5 | 13 | 1101 | 15 | d |
6 | 110 | 6 | 6 | 14 | 1110 | 16 | e |
7 | 111 | 7 | 7 | 15 | 1111 | 17 | f |
The pattern in the last two columns is the reason hexadecimal exists: one hex digit is exactly four bits, so a byte is always two digits and never anything else. Octal does the same trick with three bits, which is why Unix file permissions are octal.
Powers of two worth recognising
| Power | Value | Where it shows up |
|---|---|---|
2^8 | 256 | Values in one byte, 0 to 255 |
2^10 | 1024 | A kibibyte, and why 1 KB is sometimes 1000 and sometimes 1024 |
2^16 | 65536 | Port numbers, and the old 64K memory limit |
2^31 | 2147483648 | One past the largest signed 32-bit integer |
2^32 | 4294967296 | IPv4 addresses, in total |
2^53 | 9007199254740992 | Where JavaScript stops counting whole numbers exactly |
2^64 | 18446744073709551616 | The address space of a 64-bit machine |
Prefixes tell a compiler which base you meant: 0x for hexadecimal,
0b for binary, 0o for octal in Python, Rust and modern
JavaScript. C wrote octal as a bare leading zero, so 010 is 8 and not
10, which has caused more bugs than it ever saved keystrokes. This page accepts the
prefixes and ignores spaces, so 1010 1010 pastes in as written.
Common conversions
The pairs looked up most often have a page each, though every base is converted at once on all of them:
Your data stays on your device
Everything above runs inside your browser as WebAssembly compiled from Rust. Nothing you type is uploaded, logged or stored on a server. You can load this page once, go offline, and it still works.
This page makes no requests at all, to anywhere. That is not a promise in the copy: it is a Content-Security-Policy header your browser enforces, and connect-src on it is none. Open the network tab and watch nothing happen.