Number Base Converter
Convert between binary, octal, decimal and hexadecimal. Type in any field and the others update as you go.
| Decimal | Binary | Octal | Hex |
|---|
Why hex and binary line up so neatly
One hexadecimal digit is exactly four binary digits, so any byte is precisely two hex characters — which is why memory dumps, colour codes and permission masks are all written in hex rather than decimal. Octal groups three bits at a time, which is why Unix file permissions come in threes: 755 is 111 101 101, read as owner, group, other.
Where conversions go wrong
Two traps. A leading zero makes a number octal in several languages and configuration formats, so 010 is 8 rather than 10. And JavaScript loses integer precision above 253, so a 64-bit identifier converted through a browser tool — this one included — can come back subtly wrong. For large IDs, use a language with real 64-bit integers.
Common questions
Why are Unix permissions written in octal?
Because one octal digit is exactly three bits, and permissions come in groups of three: read, write, execute. 755 is 111 101 101.
Why is one hex digit worth four bits?
Because 16 is 2 to the fourth power, so every hex character maps onto exactly four binary digits — and every byte onto exactly two hex characters.
Can it handle very large numbers?
Not reliably above 2^53, which is JavaScript's exact-integer limit. For 64-bit identifiers use a language with native 64-bit integer support.