Number Base Converter

Type a number in any base — see it in all the others immediately.

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

  1. Type the digits into Value exactly as written in the source — no 0x, 0b or 0o prefixes needed.
  2. Set Input base to whatever that value is currently expressed in, or choose Custom for anything from 2 to 36.
  3. For Custom, enter the base itself (12 for duodecimal, say) in the field that appears.
  4. 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

DecimalBinaryOctalHexNote
81000108First 4-bit value
15111117FOne full hex digit
64100000010040Common block size
12711111111777FMax signed 8-bit
25511111111377FFMax unsigned byte
1024100000000002000400One kibibyte
655351111111111111111177777FFFFMax 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

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.