Number Base Converter
- Choose the source base: binary, octal, decimal or hexadecimal.
- Type the value. Prefixes such as 0b, 0o and 0x are accepted and ignored, and underscores can separate groups.
- All four bases appear at once, so there is no target base to choose.
- Characters invalid for the chosen base stop the conversion rather than returning a wrong result.
- Binary, base 2, uses only 0 and 1. It is how hardware actually represents data.
- Octal, base 8, uses 0 to 7. It survives mainly in Unix file permissions, such as 755.
- Decimal, base 10, is everyday notation.
- Hexadecimal, base 16, uses 0 to 9 and A to F. Each digit represents exactly 4 bits, which makes reading bytes far more compact.
A byte holds 8 bits and fits exactly into two hexadecimal digits. That makes conversion between hex and binary direct, digit by digit, with no arithmetic at all.
It is why CSS colours are hexadecimal: #FF8800 is three bytes, one per channel. It is also why memory addresses, hashes and binary dumps are displayed that way.
In binary, the same #FF8800 would need 24 characters. In decimal, it would lose the direct correspondence with the bytes.
Conversion uses BigInt, the arbitrary precision integer type in JavaScript. That means numbers larger than 2^53 convert with no loss of precision.
This is a practically relevant difference: implementations using ordinary floating point numbers start rounding above that limit, and a long hash or identifier converts incorrectly with no warning.
Only positive integers are accepted, with no conversion of fractions or negatives.
Frequently asked questions
No. If you paste it with the prefix, it is recognised and discarded. Without a prefix it works the same, as long as the source base is selected correctly.
Yes. Conversion uses BigInt and loses no precision above 2^53, unlike implementations based on floating point.
Because it is octal. Each digit represents three bits — read, write and execute — for owner, group and others. A 7 is 111 in binary, meaning all three permissions on.
No. The tool works only with positive integers.
No. Everything is converted in your browser.