Our everyday number system is base 10 (decimal) — it uses ten digits (0-9) and each position represents a power of 10. Binary (base 2) and hexadecimal (base 16) represent the exact same numeric values using a different count of digits per position, and both are fundamental to how computers store and process data.
How positional number systems work, using decimal as the familiar example. In a decimal number like 347, each digit's position represents a power of 10: the digit in the tens place is worth ten times more than the same digit would be in the ones place. 347 = 3×100 + 4×10 + 7×1 = 3×10² + 4×10¹ + 7×10⁰.
Binary: Base 2
Each position represents a power of 2 instead of a power of 10. The binary number 1011 means 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 8+0+2+1 = 11 in decimal.
Worked example: convert 25 (decimal) to binary. Find the largest power of 2 that fits, subtract, and repeat. 25: largest power of 2 fitting is 16 (2⁴), remaining 9. Next: 8 (2³) fits, remaining 1. Next: 4 (2²) doesn't fit into 1. Next: 2 (2¹) doesn't fit. Next: 1 (2⁰) fits, remaining 0. Positions used: 2⁴, 2³, 2⁰ — so the binary digits, from 2⁴ down to 2⁰, are 1,1,0,0,1. 25 (decimal) = 11001 (binary). Checking: 16+8+0+0+1=25. Correct.
Worked example: convert 1101 (binary) to decimal. 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8+4+0+1 = 13.
Hexadecimal: Base 16
Each position represents a power of 16. The hex number 2F means 2×16¹ + 15×16⁰ (since F=15) = 32+15 = 47 in decimal.
Worked example: convert 200 (decimal) to hexadecimal. 200 ÷ 16 = 12 remainder 8. So the digits are 12 (which is C in hex) and 8, read as C8. Checking: C=12, so C8 = 12×16 + 8 = 192+8 = 200. Correct.
Worked example: convert 3A (hex) to decimal. 3×16 + 10 (A=10) = 48+10 = 58.
Why computers use binary specifically. A binary digit (bit) has exactly two states, which maps directly onto an electronic circuit being either on or off (or a transistor either conducting or not) — this makes binary the natural, physically simplest representation for digital electronics, even though it requires more digits than decimal to represent the same value (25 needs five binary digits but only two decimal digits).
Why hexadecimal is used alongside binary, rather than instead of it. Hexadecimal is popular in computing specifically because it converts to and from binary extremely cleanly: each single hex digit corresponds to exactly four binary digits (since 16=2⁴), making hex a compact, human-friendlier shorthand for long binary strings. The binary number 11111111 (eight digits) is simply FF in hex — much easier to read and write than the full binary string, while still converting back losslessly.
Worked example showing the binary-hex shortcut directly: convert 10110110 (binary) to hex. Split into groups of four from the right: 1011 and 0110. 1011 = 8+0+2+1 = 11 = B in hex. 0110 = 0+4+2+0 = 6. Combined: B6. This grouping trick works because each hex digit's four binary bits convert independently, without needing to go through decimal at all.
Common Mistakes With Binary and Hex
Forgetting that hex digits A-F represent 10-15, not just single-digit values, is a frequent error — misreading "F" as somehow meaning a two-digit "15" written differently, when it's genuinely a single hexadecimal digit occupying one position. A second common mistake in binary-to-decimal conversion is misaligning which power of 2 corresponds to which position, especially miscounting from the right (2⁰ is the rightmost digit, not the leftmost).
Worked example: convert 500 (decimal) to hex directly. 500 ÷ 16 = 31 remainder 4. 31 ÷ 16 = 1 remainder 15 (F). 1 ÷ 16 = 0 remainder 1. Reading remainders from last to first: 1, F, 4 — so 500 (decimal) = 1F4 (hex). Checking: 1×256 + 15×16 + 4×1 = 256+240+4=500. Correct.
Worked example: convert FF (hex) to binary using the four-bit shortcut, without going through decimal. F = 1111 in binary (since F=15=8+4+2+1). So FF (two F's) = 11111111 in binary — simply concatenating each hex digit's four-bit binary form. This is exactly why hex is so convenient in computing: an 8-bit byte (11111111) is compactly written as just two hex characters (FF), versus eight binary characters.
Octal (base 8), a third system worth a brief mention. Less common today than binary and hex, but built on the identical positional logic, using digits 0-7 and powers of 8 per position. The octal number 17 means 1×8+7=15 in decimal. Octal was more prevalent in early computing (particularly systems built around 3-bit groupings) before hexadecimal's cleaner alignment with 4-bit and 8-bit architectures became the dominant convention.
Worked example: convert 47 (decimal) directly to hexadecimal, comparing the result to its binary form above. 47 ÷ 16 = 2 remainder 15 (F). 2 ÷ 16 = 0 remainder 2. Reading remainders last to first: 2, F. 47 (decimal) = 2F (hex). Checking against the binary result above (101111): grouping into four-bit chunks from the right, 0010 and 1111, gives 2 and F exactly — the same two representations of 47, cross-verified against each other through the binary-hex shortcut.
Worked example: convert 47 (decimal) to binary, one more full worked conversion for practice. Largest power of 2 fitting: 32 (2⁵), remaining 15. Next: 8 (2³) fits, remaining 7. Next: 4 (2²) fits, remaining 3. Next: 2 (2¹) fits, remaining 1. Next: 1 (2⁰) fits, remaining 0. Positions used: 2⁵,2³,2²,2¹,2⁰ (skipping 2⁴). Binary digits from 2⁵ down to 2⁰: 1,0,1,1,1,1. 47 (decimal) = 101111 (binary). Checking: 32+0+8+4+2+1=47. Correct.
A quick sanity check worth running on any binary-to-decimal or hex-to-decimal conversion. Estimate the rough size first: an 8-digit binary number can represent at most 255 (11111111), so any computed decimal result larger than that signals a miscounted position. Similarly, a two-digit hex number tops out at 255 (FF) — useful boundaries to keep in mind when double-checking a conversion by hand.
For the underlying place-value concept these systems share with our everyday decimal system, see Understanding Exponents and Powers.