All Infographics
Binary, Decimal, Hexadecimal infographic - Number Systems and Base Conversion

Click image to open full size

Computer Science

Binary, Decimal, Hexadecimal

Number Systems and Base Conversion

Computers store and process information using binary (base 2), where every digit is either 0 or 1, corresponding to the two voltage states of electronic circuits. Humans write numbers in decimal (base 10) — ten digits, 0 through 9 — and each position represents a power of ten. Hexadecimal (base 16) uses sixteen symbols (0–9 and A–F) and is commonly used in computing because one hex digit maps exactly to four binary digits (bits), making large binary values far more readable.

Converting between bases relies on place value. In binary, the rightmost digit has value 2⁰ = 1, the next 2¹ = 2, then 2² = 4, and so on. The decimal number 42 is 00101010₂ in binary (32+8+2) and 2A₁₆ in hex. To convert decimal to binary, repeatedly divide by 2 and record the remainders in reverse. Hex is especially useful for representing memory addresses, RGB colors, and machine-level instructions where bit-level manipulation is important.

Key Facts

  • Binary (base 2): digits 0 and 1; each position is a power of 2
  • Decimal (base 10): digits 0–9; each position is a power of 10
  • Hexadecimal (base 16): digits 0–9, A–F; each position is a power of 16
  • 1 hex digit = 4 binary bits; 2 hex digits = 1 byte (8 bits)
  • Decimal to binary: divide by 2, record remainders in reverse
  • Binary to hex: group bits in sets of 4 from the right, convert each group

Vocabulary

Bit
The smallest unit of digital information; a single binary digit, either 0 or 1.
Byte
A group of 8 bits; can represent 256 different values (0–255 in decimal, 00–FF in hex).
Place value
The value of a digit determined by its position in the number; each position represents a power of the base.
Base (radix)
The number of unique digits a positional numeral system uses; binary is base 2, decimal is base 10, hex is base 16.
Hexadecimal
A base-16 number system using digits 0–9 and letters A–F; widely used in computing to represent binary data compactly.

Common Mistakes to Avoid

  • Confusing hex letters with decimal values. In hex, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. FF in hex is 255 in decimal, not 11.
  • Forgetting to group binary digits from the right when converting to hex. Starting from the left can create unequal groups. Always pad with leading zeros so the total number of bits is a multiple of 4.
  • Treating 0x prefix as part of the value. '0x' (or '0b' for binary) is a notation prefix indicating the base — the prefix itself has no numeric value.
  • Assuming hex numbers are always larger than decimal numbers with the same digits. The value depends on the base: 10 in hex equals 16 in decimal, not 10.

Practice Questions

  1. 1 Convert the decimal number 173 to binary and to hexadecimal. Show your work.
  2. 2 The hexadecimal color code for a web page element is #3A7F. Convert each pair of hex digits to decimal to find the RGB values.
  3. 3 Why do computers use binary internally rather than decimal? Explain the connection to the physical properties of electronic components.