Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36 — with exact arithmetic at any size, and a two's-complement view that shows the same bits read signed and unsigned.
The same number in four bases
Bases are notations, not values: 255, 0xFF and 11111111 are one number written three ways. Hexadecimal earns its place because each digit is exactly four bits, so a byte is always two hex digits — 0xFF is 11111111 with no counting required. Octal survives mostly in Unix file permissions, where each digit is one rwx triple.
| Decimal | Binary | Octal | Hex | Where you meet it |
|---|---|---|---|---|
| 8 | 1000 | 10 | 8 | a single bit above 7 |
| 255 | 11111111 | 377 | ff | one full byte; a channel of RGB |
| 4096 | 1000000000000 | 10000 | 1000 | a memory page |
| 65535 | 16 ones | 177777 | ffff | the largest 16-bit unsigned value; the highest port number |
| 16777215 | 24 ones | 77777777 | ffffff | #ffffff — white, the largest 24-bit colour |
Reading the two's-complement panel
Pick a width and the panel shows the exact bit pattern a signed integer of that width would hold, then reads the same bits both ways. The two numbers differ whenever the top bit is set — that bit is worth −2w−1 signed and +2w−1 unsigned, so the readings are always exactly 2w apart. The classic sightings: −1 as 255, 4294967295, or 18446744073709551615, depending on width.
Everything runs in your browser with exact integer arithmetic — nothing you type is sent anywhere.
Frequently asked questions
Why does the tool use exact arithmetic?
Because the numbers people bring here — 64-bit hashes, database ids, bitmasks — are exactly the ones ordinary floating-point arithmetic corrupts. JavaScript's Number keeps 53 bits of precision, so parseInt on 0xDEADBEEFDEADBEEF quietly loses the low bits and still prints a confident answer in every base. This tool computes with arbitrary-precision integers, so a value of any length converts exactly.
What do the 0x, 0b and 0o prefixes mean?
They are how programming languages mark the base of a literal: 0x for hexadecimal, 0b for binary, 0o for octal. The tool accepts each prefix when the matching base is selected and strips it before converting. It deliberately refuses 0x in a binary field rather than guessing — a prefix that contradicts the declared base is a sign the wrong field is selected.
Why is there a 9 in my octal error?
Each base has exactly as many digits as its size: octal uses 0–7, binary 0–1, hexadecimal 0–9 plus a–f. A 9 in an octal number cannot mean anything, so the tool refuses the input instead of skipping the digit — skipping would silently convert a different number than the one you pasted.
What is two's complement?
The way computers store negative integers. At a fixed width, a negative number is stored as its value plus 2 to the width: -1 in 8 bits is 11111111, which is also how 255 is stored. The bits alone cannot tell you which was meant — that is decided by the type in the source code. The tool shows both readings side by side precisely because this ambiguity is a classic source of bugs.
Why do I get 4294967295 where I expected -1?
That is the two's-complement confusion in the wild: a 32-bit -1 read as unsigned. The bit pattern of -1 at 32 bits is thirty-two ones, and read unsigned those bits are 4294967295. Whenever a huge round-ish number like 65535, 4294967295 or 18446744073709551615 appears where a small negative was expected, a signed value has been read through an unsigned type — or the reverse.
What are bases above 16 used for?
Base 36 — digits 0–9 then a–z — is the densest encoding that stays case-insensitive, which makes it common for short ids in URLs. Base 32 variants appear in one-time-password secrets and file identifiers. The converter goes up to 36 so those values can be decoded too; beyond that there is no agreed digit alphabet.
Related tools
- Diagram & Flowchart MakerDraw flowcharts and diagrams, connect the boxes with arrows that route themselves, and let it arrange the whole thing. Exports SVG. Nothing is uploaded.
- Password GeneratorGenerate strong random passwords using your browser's cryptographic RNG, with a live strength estimate.
- HTML Entity EncoderEncode text for HTML or decode entities back — the five markup breakers, named Latin-1 and symbol sets, numeric references up to emoji. Decodes exactly once.