Number Base Converter (Binary, Octal, Decimal, Hexadecimal)
Convert numbers between binary, octal, decimal, and hexadecimal. Uses BigInt so even very large integers are converted with no loss of precision.
Usage Tips
- When entering a hexadecimal value, omit prefixes like `0x` and enter only the digits (e.g. `FF`). Both uppercase and lowercase letters are recognized.
- This tool uses BigInt internally, so it can accurately convert very large integers (beyond 2^53) that would lose precision with JavaScript's Number type.
- Handy for everyday programming tasks, such as reading hex color codes (e.g. `#FF0000`) or checking binary representations when verifying bitwise operations.
- Octal is commonly used for Unix-style file permissions (e.g. `755`). Comparing it side by side with decimal and binary makes the meaning of each permission easier to understand.
Frequently Asked Questions
Side Note — Why Do Computers Run on Binary?
Computers are built on binary (0 and 1) because electronic circuits can reliably distinguish between just two states — "high voltage / low voltage" or "switch on / switch off." Building a circuit that must precisely distinguish ten different voltage levels, as decimal would require, is far more sensitive to noise and more complex than one that only needs to tell two states apart. For these practical engineering reasons, nearly every modern computer is built on binary.
Hexadecimal is so useful in programming because of a neat mathematical fact: exactly four binary digits (0000 through 1111) map onto exactly one hexadecimal digit (0 through F). A single byte (8 bits), for example, can be written as just two hexadecimal digits (`00` through `FF`), compressing what would otherwise be eight binary digits into a much more readable length.
Octal became popular for historical reasons: early computers such as the PDP-8 (1960s) used word sizes that were multiples of 3 bits — 12 bits or 36 bits, for instance — which made octal a natural fit at the time. Once computers standardized on word sizes that are multiples of 4 bits — 8, 16, or 32 bits — hexadecimal became the more practical choice, and it remains dominant today. Even so, octal still survives in certain niches, such as Unix file permissions.