Number Base Converter
Type a number in any base — see it in all the others immediately.
Bits needed: —
Whole numbers only.
What a number base actually is
A base is how many distinct digits a system uses before a column rolls over. Decimal has ten digits, so after 9 comes 10. Binary has two, so after 1 comes 10 — which is the number two, not ten. Each column is worth the base raised to its position, counting from zero on the right, and that one rule is enough to build every base from 2 up to 36.
The bases people actually use map onto real hardware and conventions. Binary matters because a transistor is a switch: on or off, one or zero, nothing in between. Hexadecimal packs binary tightly — one hex digit is exactly four bits, so a byte is always two hex characters, which is why memory addresses and colour codes are written in hex rather than long strings of ones and zeros. Octal survives mainly in Unix file permissions, where three bits per group line up neatly with read, write and execute.
How to use this converter
- Type the digits into Value exactly as written in the source — no 0x, 0b or 0o prefixes needed.
- Set Input base to whatever that value is currently expressed in, or choose Custom for anything from 2 to 36.
- For Custom, enter the base itself (12 for duodecimal, say) in the field that appears.
- Press Convert. The panel fills in binary, octal, decimal and hex at once, plus the minimum bits the value needs.
Worked example 1: binary to decimal
Take 1011. Positions from the right are worth 1, 2, 4 and 8. Reading right to left the digits are 1, 1, 0, 1, so the value is 1 + 2 + 0 + 8 = 11. In hex that is B, and in octal 13. Seeing all four at once is the fastest way to sanity-check a value you have half-converted in your head.
Worked example 2: hex to decimal, the colour case
CSS colours are hex byte triplets. The red channel in #FF8800 is FF, which is 15×16 + 15 = 255 — the maximum a byte can hold. The green channel 88 is 8×16 + 8 = 136. The blue channel is 00, so this colour is pure orange with no blue at all. Knowing that FF is 255 and 80 is roughly 128 lets you judge whether a colour is near-saturated or about half strength without opening a picker.
Worked example 3: file permissions in octal
chmod 755 is three octal digits, each holding three bits: 7 is 111 (read, write, execute), 5 is 101 (read, execute, no write). Enter 755 with base 8 selected and the binary output reads 111101101 — exactly the nine permission bits, owner then group then everyone, in order. This is why Unix modes are written in octal rather than hex: three bits per digit is a perfect fit, four bits is not.
Common values across the four bases
| Decimal | Binary | Octal | Hex | Note |
|---|---|---|---|---|
| 8 | 1000 | 10 | 8 | First 4-bit value |
| 15 | 1111 | 17 | F | One full hex digit |
| 64 | 1000000 | 100 | 40 | Common block size |
| 127 | 1111111 | 177 | 7F | Max signed 8-bit |
| 255 | 11111111 | 377 | FF | Max unsigned byte |
| 1024 | 10000000000 | 2000 | 400 | One kibibyte |
| 65535 | 1111111111111111 | 177777 | FFFF | Max unsigned 16-bit |
Negative numbers: why this tool shows a sign, not two's complement
This converter represents a negative value as a minus sign in front of the magnitude, in every base, rather than as two's complement. That is deliberate. Two's complement is how processors store signed integers in binary: to get -5 in an 8-bit word, write 5 as 00000101, flip every bit to get 11111010, then add 1 to get 11111011. The same -5 in a 16-bit word is 1111111111111011 — a different bit pattern, because two's complement only makes sense once you fix a word width (8, 16, 32 or 64 bits). A converter that does not know your target width would have to guess it, and a wrong guess prints a bit pattern that looks valid but is the wrong number. If you need the two's-complement pattern for a chosen width, take the binary output for the positive magnitude, invert every bit, and add 1.
Common mistakes and practical limits
- Digits that do not belong to the base. Typing 129 with base 8 selected is a mistake, not a value — octal only has digits 0-7. Standard parsers often stop at the first bad digit and silently return 12; this converter rejects the whole input instead.
- Letters beyond the base's range. In base 16, only A-F are valid; a G is usually a decimal digit typed in the wrong field.
- Precision above 2^53. That is the largest integer JavaScript represents exactly. Past it, results would silently lose precision, so the tool refuses rather than printing a plausible-looking wrong answer.
- Base 36 as the practical ceiling. Ten numerals plus 26 letters run out of symbols at 36 — why base 36 shows up in short URL slugs and identifiers, packing the most value per character while staying alphanumeric.
Sources & further reading
Frequently asked questions
How do I convert binary to decimal by hand?
Multiply each digit by two raised to its position, counting from zero on the right, and add. For 1011: 1x8 + 0x4 + 1x2 + 1x1 = 11. The converter does the same thing, which is useful when you want to check your own working rather than replace it.
Why does hexadecimal use letters?
Base 16 needs 16 distinct digits and we only have ten numerals, so A to F stand for 10 to 15. Hex is popular because one hex digit is exactly four bits, so a byte is always two hex characters — far easier to read than eight ones and zeros.
What does the bit count tell me?
It is the smallest number of binary digits that can hold the value, which tells you the smallest integer type that fits. A value needing 9 bits will not fit in an 8-bit byte, and one needing 33 bits overflows a 32-bit signed integer.