Number Base Converter

Type a number in any base from 2 to 36 and see it in all the common ones at once, with the binary laid out in bytes so the bit pattern is actually readable. Useful for reading flags and masks, debugging colour values, and anywhere a hex dump needs decoding.

Why hexadecimal

One hex digit is exactly four bits, so a byte is always two digits and the mapping is mechanical with no arithmetic. 0xFF is visibly eight set bits; the decimal 255 gives no such hint. That alignment is the entire reason hex is everywhere in low-level work - memory addresses, colour values, byte dumps.

Prefixes and one famous bug

0x marks hex, 0b binary, 0o octal. In C and several older languages a bare leading zero meant octal, so 010 is 8, not 10 — a bug that has caught people out for decades, most memorably in date handling where 09 is not even a valid octal number. Modern languages require the explicit 0o.

Where octal survives

Mostly Unix file permissions, where three permission bits map exactly onto one octal digit: chmod 755 is rwxr-xr-x. Outside that niche it has been almost entirely displaced by hexadecimal.

Bases beyond 16

Any base up to 36 works, using the digits 0-9 then A-Z. Base 36 is the densest that stays alphanumeric, which is why it shows up in short URL identifiers and compact IDs.

Frequently asked questions

Why do programmers use hexadecimal?

Because one hex digit maps to exactly four bits, so a byte is always two digits and the conversion is mechanical. Decimal has no such alignment - 255 gives no hint that it is eight set bits, while 0xFF makes it obvious at a glance.

What do the 0x, 0b and 0o prefixes mean?

They mark the base in source code: 0x for hexadecimal, 0b for binary, 0o for octal. A leading zero alone meant octal in C and several older languages, which is a famous source of bugs - 010 is 8, not 10. Modern languages require the explicit 0o.

Why is octal still around?

Mainly Unix file permissions, where three bits map neatly to one octal digit: chmod 755 is rwxr-xr-x. Outside that it has largely been replaced by hexadecimal.

Related tools

Steuervergleich Kanton Zürich — Gemeindesteuern vergleichen (Deutsch)