Complete Beginner's Guide to Number Systems (With Examples & Explanations)
🔢 What Are Number Systems?
A number system is a way to represent numbers. Computers use different number systems like binary,
octal, decimal, and hexadecimal to store and process data.
1. 📈 Decimal Number System (Base 10)
Digits used: 0 to 9\ Base: 10 (each digit is multiplied by powers of 10)
Example:
123 (Decimal) means:
1 × 10^2 + 2 × 10^1 + 3 × 10^0
= 100 + 20 + 3 = 123
✅ This is the number system we use in daily life.
2. 💡 Binary Number System (Base 2)
Digits used: 0 and 1\ Base: 2
Example: Convert (1010)₂ to Decimal:
1 × 2^3 + 0 × 2^2 + 1 × 2^1 + 0 × 2^0
= 8 + 0 + 2 + 0 = 10 (Decimal)
Reverse: Convert Decimal 10 to Binary:
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Bottom to top: 1010
✅ So, 10 (Decimal) = 1010 (Binary)
1
3. 🐙 Octal Number System (Base 8)
Digits used: 0 to 7\ Base: 8
Example: Convert (157)₈ to Decimal:
1 × 8^2 + 5 × 8^1 + 7 × 8^0
= 64 + 40 + 7 = 111 (Decimal)
Reverse: Convert Decimal 25 to Octal:
25 ÷ 8 = 3 remainder 1
3 ÷ 8 = 0 remainder 3
Bottom to top: 31
✅ So, 25 (Decimal) = 31 (Octal)
4. 🌟 Hexadecimal Number System (Base 16)
Digits used: 0 to 9 and A to F\ A = 10, B = 11, ..., F = 15\ Base: 16
Example: Convert (FF)₁₆ to Decimal:
F × 16^1 + F × 16^0
= 15 × 16 + 15 × 1 = 240 + 15 = 255
Reverse: Convert Decimal 255 to Hexadecimal:
255 ÷ 16 = 15 remainder 15 (F)
15 ÷ 16 = 0 remainder 15 (F)
Bottom to top: FF
✅ So, 255 (Decimal) = FF (Hexadecimal)
🪤 Python Code Snippets to Try:
print(bin(10)) # Output: 0b1010 (Binary)
print(oct(25)) # Output: 0o31 (Octal)
2
print(hex(255)) # Output: 0xff (Hexadecimal)
print(int("1010", 2)) # Binary to Decimal => 10
print(int("31", 8)) # Octal to Decimal => 25
print(int("FF", 16)) # Hex to Decimal => 255
✨ Summary Table:
Number System Base Digits Used Example (Decimal 255)
Decimal 10 0 to 9 255
Binary 2 0, 1 11111111
Octal 8 0 to 7 377
Hexadecimal 16 0–9 + A–F FF
This guide is perfect for anyone in Class 11 or new to programming. Practice converting back and forth, and
you’ll master these quickly!