How Number Bases Work
Everyday numbers are base 10 (decimal): each digit is worth ten times the one to its right. Computers use base 2 (binary) because circuits have two states, and programmers use base 16 (hexadecimal) as a compact shorthand โ one hex digit represents exactly four binary digits.
Converting Between Bases
- To decimal: multiply each digit by the base raised to its position and add up. Binary 1011 = 1x8 + 0x4 + 1x2 + 1x1 = 11.
- From decimal: repeatedly divide by the target base and read the remainders backwards.
- Binary to hex shortcut: group binary digits in fours and convert each group (1010 1111 = AF).
Why Programmers Love Hex
Memory addresses, color codes (#FF5733), and Unicode values are all written in hex because it is far shorter than binary but converts to it trivially. A single byte (0โ255) is always exactly two hex digits.
Practice Tool
Type a value in any base above and watch all four representations update live, with the conversion steps shown. Also try the Roman numeral converter for a historical number system, or number to words for plain English.