🔢 Data & Logic

Number Systems

संख्या प्रणाली

⏱ 3 hr4 topicsInteractive
🎯 By the end: You can convert whole numbers between binary, octal, decimal and hexadecimal by hand and explain why computers use binary.

Deep down, a computer can only tell two things apart: a wire is on or off, 1 or 0. Everything — this page, your photos, every Python program — is built from those two digits. To understand computers, you first have to understand how they count. The good news: once you've played with the simulator below, conversions you used to fear become almost mechanical.

1Why computers count in twos

We humans count in base 10 (decimal) — ten digits, 0 to 9 — almost certainly because we have ten fingers. A computer has no fingers; it has electrical switches that are either on or off. So it counts in base 2 (binary) — just two digits, 0 and 1. Each binary digit is called a bit.

A number system is defined by its base (also called the radix) — how many distinct digits it uses:

SystemBaseDigits usedWhere you meet it
Binary20, 1Inside every computer
Octal80–7Compact shorthand for binary
Decimal100–9Everyday human counting
Hexadecimal160–9, A–FColours (#FF6B00), memory addresses
Hexadecimal's extra digits: after 9 it needs six more single-symbol digits, so it borrows letters — A=10, B=11, C=12, D=13, E=14, F=15. That's why a colour code like #FF6B00 is just three hex numbers.
Key points
  • A number system's base (radix) is how many digits it uses: binary 2, octal 8, decimal 10, hex 16.
  • Computers use binary because their switches have two states: on (1) and off (0).
  • Hexadecimal uses A–F for the values 10–15.

2Place value — the key idea

Every conversion rests on one idea you already know from decimal: place value. In decimal, the number 365 means:

3 × 10²  +  6 × 10¹  +  5 × 10⁰
  300   +    60    +     5    = 365

Each position is the base raised to a power, increasing right-to-left. The exact same rule works in any base — just change the base. So binary 101101 means:

1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰
 32  +  0  +  8  +  4  +  0  +  1   = 45
To convert any base to decimal, multiply each digit by its place value (base^position) and add them up. That single method covers binary→decimal, octal→decimal and hex→decimal.
Key points
  • Place value: each position is the base raised to a power, increasing right to left (…b², b¹, b⁰).
  • Any base → decimal: multiply each digit by its place value and add.
  • Binary 101101 = 32+8+4+1 = 45.

3See it live — the Number System Simulator

Type any whole number below and watch it appear instantly in all four systems, with the working shown. Try the examples from above (like 45), then explore: what is 255 in hex? What is binary 11111111 in decimal? Play until the patterns click.

Number System Simulator
Decimal · base 1045
Binary · base 2101101
Octal · base 855
Hex · base 162D
Decimal → Binary (repeated ÷ 2)
Key points
  • The same value looks different in each base, but it is the same quantity.
  • 255 = 11111111 (binary) = 377 (octal) = FF (hex) — a useful one to remember.
  • Each extra binary digit doubles the largest number you can represent.

4Converting by hand (for the exam)

The simulator builds intuition, but in the exam you convert by hand. Here are the methods you must know.

Decimal → Binary (repeated division by 2)

Divide by 2 repeatedly, noting each remainder, then read the remainders bottom to top:

45 ÷ 2 = 22  remainder 1   ↑
22 ÷ 2 = 11  remainder 0   |
11 ÷ 2 =  5  remainder 1   |  read
 5 ÷ 2 =  2  remainder 1   |  upward
 2 ÷ 2 =  1  remainder 0   |
 1 ÷ 2 =  0  remainder 1   |

45 = 101101 in binary

Binary → Decimal

Use place value (topic 2): add up the powers of 2 where there's a 1.

The binary–octal–hex shortcut

This is the exam time-saver. Because 8 = 2³ and 16 = 2⁴:

  • Binary ↔ Octal: group binary digits in 3s (from the right); each group is one octal digit.
  • Binary ↔ Hex: group binary digits in 4s (from the right); each group is one hex digit.
101101  →  groups of 4:  0010 1101  →  2  D   →  hex 2D
101101  →  groups of 3:  101 101    →  5  5   →  octal 55
Always group from the right and pad the left with zeros if a group is short. Grouping from the left is the most common exam mistake.
Key points
  • Decimal→binary: divide by 2 repeatedly, read remainders bottom-to-top.
  • Binary→octal: group bits in 3s; binary→hex: group bits in 4s — always from the right.
  • Pad short left-hand groups with zeros.

★ Practical: convert without the simulator

Cover the simulator and do these by hand, then check yourself:

  1. Convert decimal 90 to binary (repeated division by 2).
  2. Convert binary 110011 to decimal (place value).
  3. Convert binary 11011010 to hexadecimal (group in 4s).
  4. Convert hexadecimal A5 to decimal, then to binary.

Ready for the chapter test?

Answer 5 questions. Score 60% or more to mark this chapter complete.

Start the test →

💡 Log in to save your progress and earn the certificate.