Number Base
Binary, octal, decimal, hex and arbitrary radix
A base is simply how many distinct digits a positional system uses before it carries. Decimal has ten, binary two, octal eight and hexadecimal sixteen — the last borrowing A through F for the values ten to fifteen. The number itself does not change when you convert; only its spelling does.
Hexadecimal earns its place in programming because one hex digit maps exactly onto four bits, so a byte is always two characters and a bitmask stays readable. Octal survives mainly in Unix file permissions, where three bits per digit line up with read, write and execute. This converter shows a value in every base at once, including arbitrary radixes up to 36.
How to use it
- Enter a value in any baseType a decimal number, a hex value, a binary string or a value in a custom radix, and the other representations follow.
- Read the grouped outputBinary is grouped in fours so it lines up with hex digits, which makes reading a bitmask or spotting a set flag practical rather than an exercise in counting.
- Use an arbitrary radix when you need oneBases from 2 to 36 are supported, using digits then letters, which covers base32 and base36 identifier schemes.
Frequently asked questions
Why do programmers use hexadecimal instead of decimal?
Because it maps cleanly onto binary. Sixteen is two to the fourth, so each hex digit is exactly four bits and every byte is exactly two hex digits — no arithmetic required to see the bit pattern. Decimal has no such alignment, so 200 tells you nothing about which bits are set while 0xC8 tells you immediately.
What do prefixes like 0x, 0b and 0o mean?
They are how source code marks the base of a literal: 0x for hexadecimal, 0b for binary, 0o for octal in modern languages. A bare leading zero also means octal in C and several older languages, which is a notorious source of bugs — 010 is eight, not ten.
How do I convert between binary and hex by hand?
Group the binary digits in fours from the right and translate each group into one hex digit. 1101 0110 is D6. The direction reverses just as easily, which is why the two bases are used together and why binary output is conventionally grouped in fours.
Why is octal still used for file permissions?
Because Unix permissions come in triples — read, write, execute — for owner, group and other. Three bits is exactly one octal digit, so 755 encodes rwxr-xr-x with no ambiguity. It is the one place where base eight remains genuinely the clearest notation.
How large a number can be converted safely?
Beyond about 2^53 a JavaScript number loses integer precision, so very large values need arbitrary-precision handling to convert without silently rounding. If you are working with 64-bit identifiers, check that whatever consumes the result treats them as strings rather than numbers.