StudyHub24
StudyHub24
YouTube
Home/Computer

Computer Number Systems: Binary, Decimal, Octal, and Hexadecimal

Computers operate using digital logic, which relies on the Binary Number System (0 and 1). To understand how data is processed, we must learn how to convert between different number systems used in computing.


📊 Quick Reference Table

Number SystemBaseDigits / Range
Binary20, 1
Octal80, 1, 2, 3, 4, 5, 6, 7
Decimal100, 1, 2, 3, 4, 5, 6, 7, 8, 9
Hexadecimal160-9 and A-F (A=10, B=11, C=12, D=13, E=14, F=15)

1. Decimal to Binary

To convert a Decimal number to Binary, we repeatedly divide the number by 2 and track the remainders.

Steps:

  1. Divide the decimal number by 2.
  2. Write down the remainder (0 or 1).
  3. Repeat the process with the quotient until it becomes 0.
  4. Read the remainders from bottom to top.
💡 Tip

Example:Convert (13)₁₀ to Binary.

  • 13 ÷ 2 = 6, Remainder: 1
  • 6 ÷ 2 = 3, Remainder: 0
  • 3 ÷ 2 = 1, Remainder: 1
  • 1 ÷ 2 = 0, Remainder: 1 Result: (1101)₂

2. Binary to Decimal

To convert Binary to Decimal, multiply each digit by 2 raised to the power of its position (starting from 0 on the right).

Formula: d₀×2⁰ + d₁×2¹ + d₂×2² ...

Example: Convert (1011)₂ to Decimal.

  • (1 × 2³) + (0 × 2²) + (1 × 2¹) + (1 × 2⁰)
  • 8 + 0 + 2 + 1 = 11 Result: (11)₁₀

3. Binary to Octal & Hexadecimal

These conversions are easiest when done using the "Grouping" method.

Binary to Octal (Base 8)

  • Group the binary digits into sets of 3 starting from the right.
  • Assign weights (4, 2, 1) to each group.
  • Example: (110101)₂ -> (110) (101) -> 6 5 -> (65)₈

Binary to Hexadecimal (Base 16)

  • Group the binary digits into sets of 4 starting from the right.
  • Assign weights (8, 4, 2, 1) to each group.
  • Example: (11011011)₂ -> (1101) (1011) -> 13 11 -> (DB)₁₆

4. Hexadecimal Table (A-F)

DecimalHexadecimalBinary (4-bit)
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111

ℹ️ Note

Always remember that theBaserepresents the number of unique digits in that system. A higher base allows us to represent large numbers with fewer digits (compact representation).