Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Number bases are systems for writing numbers using different sets of digits. This cheat sheet covers decimal, binary, octal, and hexadecimal notation used in computer science. Students need these bases because computers store and process data using bits, and programmers often use octal or hexadecimal as shorter ways to write binary values. The core idea is place value: each digit is multiplied by a power of the base. Binary uses base 2, octal uses base 8, decimal uses base 10, and hexadecimal uses base 16. Conversions often use repeated division, place value expansion, or grouping binary digits into sets of 3 for octal and sets of 4 for hexadecimal.

Key Facts

  • In base b, each digit place represents a power of b, such as b^0, b^1, b^2, and b^3 from right to left.
  • Binary is base 2 and uses only the digits 0 and 1.
  • Octal is base 8 and uses the digits 0 through 7.
  • Hexadecimal is base 16 and uses the digits 0 through 9 and the letters A, B, C, D, E, and F for values 10 through 15.
  • To convert a number to decimal, multiply each digit by its place value and add the results, such as 1011_2 = 1×8 + 0×4 + 1×2 + 1×1 = 11.
  • To convert decimal to another base, repeatedly divide by the new base and read the remainders from bottom to top.
  • To convert binary to octal, group bits in sets of 3 from the right, because 8 = 2^3.
  • To convert binary to hexadecimal, group bits in sets of 4 from the right, because 16 = 2^4.

Vocabulary

Base
The number of different digit symbols used in a number system.
Binary
A base 2 number system that uses only 0 and 1.
Octal
A base 8 number system that uses the digits 0 through 7.
Hexadecimal
A base 16 number system that uses digits 0 through 9 and letters A through F.
Bit
A single binary digit, either 0 or 1.
Place Value
The value of a digit based on its position in a number and the base being used.

Common Mistakes to Avoid

  • Using invalid digits for a base is wrong because each base has a limited digit set, such as no 2 in binary and no 8 or 9 in octal.
  • Reading binary like decimal is wrong because 1010_2 means 1×8 + 0×4 + 1×2 + 0×1, not one thousand ten.
  • Grouping binary digits from the left first is wrong for octal and hexadecimal because groups must start from the right, with zeros added on the left if needed.
  • Forgetting that A through F are numbers in hexadecimal is wrong because A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.
  • Reading remainders from top to bottom after repeated division is wrong because the correct converted number is formed by reading the remainders from bottom to top.

Practice Questions

  1. 1 Convert 110101_2 to decimal.
  2. 2 Convert 45_10 to binary using repeated division by 2.
  3. 3 Convert 3F_16 to decimal.
  4. 4 Explain why hexadecimal is often easier for humans to read than long binary strings.