Why Learn Number Systems? Every digital device you use—from smartphones to supercomputers—operates entirely on binary numbers (0s and 1s). Understanding how number systems work is the foundation for digital design, computer architecture, and hardware engineering. In this tutorial, you'll learn how computers represent and convert numbers.
12 min read | Beginner Level
What You'll Learn
- Understand decimal, binary, and hexadecimal number systems
- Convert between different number systems (decimal ↔ binary ↔ hexadecimal)
- Learn Binary-Coded Decimal (BCD) representation
- Apply conversion techniques to real-world digital design problems
What is a Number System?
A number system is a way of representing numerical values using a set of symbols and rules. It allows us to count, measure, and perform calculations. The most common number systems are:
- Decimal (base-10): Uses digits 0-9, the system we use in everyday life
- Binary (base-2): Uses only 0 and 1, the native language of computers
- Hexadecimal (base-16): Uses 0-9 and A-F, commonly used in programming and debugging
Each number system has unique properties and applications in fields such as mathematics, computer science, digital electronics, and embedded systems.
Popular Number Systems
Digital systems use different number systems depending on the application. Here are the three most important ones:
| Number System | Base | Symbols | Common Use |
|---|---|---|---|
| Decimal | 10 | 0-9 | Human-readable numbers, everyday arithmetic |
| Binary | 2 | 0, 1 | Computer hardware, digital circuits, memory |
| Hexadecimal | 16 | 0-9, A-F | Memory addresses, color codes, debugging |
Decimal Number System (Base-10)
The decimal system is the number system most commonly used in everyday life. It uses 10 symbols (0-9), and each position represents a power of 10.
Example: In the number 123:
- The digit 3 is in the ones place (100 = 1)
- The digit 2 is in the tens place (101 = 10)
- The digit 1 is in the hundreds place (102 = 100)
So, 123 = (1 × 100) + (2 × 10) + (3 × 1) = 123
Binary Number System (Base-2)
The binary system is the foundation of all digital computers. It uses only two symbols: 0 and 1. Each position (or "place") in a binary number has a value that is a power of 2 — just like decimal places are powers of 10.
To find the value of a binary number, multiply each digit by its place value, then add the results together.
Example: the binary number 1101, reading from right to left:
| Position (from right) | Place value | Binary digit | Digit × Place value |
|---|---|---|---|
| 1st | 20 = 1 | 1 | 1 × 1 = 1 |
| 2nd | 21 = 2 | 0 | 0 × 2 = 0 |
| 3rd | 22 = 4 | 1 | 1 × 4 = 4 |
| 4th | 23 = 8 | 1 | 1 × 8 = 8 |
Key idea: a 1 means "include this place value," and a 0 means "skip it" (because anything multiplied by 0 is 0).
Now add up the results:
binary 1101 = (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1) = 8 + 4 + 0 + 1 = 13 in decimal
Binary is efficient for hardware because digital circuits can easily represent two states: ON (1) and OFF (0), using voltage levels.
Hexadecimal Number System (Base-16)
Hexadecimal is commonly used in computer programming and digital electronics because it compactly represents binary data. It uses 16 symbols: 0-9 and A-F, where A=10, B=11, C=12, D=13, E=14, F=15.
Example: In the hexadecimal number A7F:
- F (15) is in the 160 place = 15 × 1 = 15
- 7 is in the 161 place = 7 × 16 = 112
- A (10) is in the 162 place = 10 × 256 = 2560
So, hexadecimal A7F = 2560 + 112 + 15 = 2687 in decimal
Where Are Number Systems Used? Hexadecimal is extensively used in memory addressing, CPU register values, color codes in web design (e.g., #FF5733), and low-level debugging. Binary is the native representation in all digital circuits, from simple logic gates to complex processors.
Converting Decimal to Binary
To convert a decimal number to binary, use the repeated division by 2 method:
- Divide the decimal number by 2
- Write down the integer quotient and the remainder (0 or 1)
- Repeat the process with the quotient until it becomes 0
- Write the remainders in reverse order (bottom to top)
Example: Convert decimal 25 to binary:
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 25 ÷ 2 | 12 | 1 |
| 2 | 12 ÷ 2 | 6 | 0 |
| 3 | 6 ÷ 2 | 3 | 0 |
| 4 | 3 ÷ 2 | 1 | 1 |
| 5 | 1 ÷ 2 | 0 | 1 |
Result: Reading remainders from bottom to top: 11001
Therefore, decimal 25 = binary 11001
To verify your conversion, convert the binary result back to decimal: (1×16) + (1×8) + (0×4) + (0×2) + (1×1) = 25 ✓
Converting Fractional Decimal to Binary
To convert a decimal fraction to binary, use the repeated multiplication by 2 method:
- Multiply the decimal fraction by 2
- Write down the integer part of the result (0 or 1)
- If the fractional part is not 0, repeat with the fractional part
- Stop when the fractional part becomes 0 or you reach the desired precision
Example: Convert decimal 0.625 to binary:
| Step | Multiplication | Integer Part | Fractional Part |
|---|---|---|---|
| 1 | 0.625 × 2 = 1.25 | 1 | 0.25 |
| 2 | 0.25 × 2 = 0.5 | 0 | 0.5 |
| 3 | 0.5 × 2 = 1.0 | 1 | 0.0 (stop) |
Result: Reading integer parts from top to bottom: 0.101
Therefore, decimal 0.625 = binary 0.101
Quick Check Q: What is the binary representation of decimal 0.75?
Show Answer
A: 0.11 (binary)
Explanation:
- 0.75 × 2 = 1.5 → integer part = 1, fractional part = 0.5
- 0.5 × 2 = 1.0 → integer part = 1, fractional part = 0.0
- Result: 0.11
Converting Binary to Decimal
To convert a binary number to decimal, multiply each bit by its corresponding power of 2 and sum the results.
Example: Convert binary 11011 to decimal:
Position: 4 3 2 1 0 Binary: 1 1 0 1 1 Power of 2: 2^4 2^3 2^2 2^1 2^0 Final Value: 16 8 0 2 1
Calculation:
1 × 16 + 1 × 8 + 0 × 4 + 1 × 2 + 1 × 1 = 27
Therefore, binary 11011 = decimal 27
Converting Binary to Hexadecimal
Binary to hexadecimal conversion is straightforward because 4 binary bits map to exactly 1 hexadecimal digit.
Steps:
- Divide the binary number into groups of 4 bits (starting from the right)
- Add leading zeros to the leftmost group if needed
- Convert each 4-bit group to its hexadecimal equivalent
Binary to Hex Conversion Table:
| Binary | Hex | Decimal |
|---|---|---|
| 0000 | 0 | 0 |
| 0001 | 1 | 1 |
| 0010 | 2 | 2 |
| 0011 | 3 | 3 |
| 0100 | 4 | 4 |
| 0101 | 5 | 5 |
| 0110 | 6 | 6 |
| 0111 | 7 | 7 |
| 1000 | 8 | 8 |
| 1001 | 9 | 9 |
| 1010 | A | 10 |
| 1011 | B | 11 |
| 1100 | C | 12 |
| 1101 | D | 13 |
| 1110 | E | 14 |
| 1111 | F | 15 |
Example: Convert binary 10110110 to hexadecimal:
- Group into 4 bits: 1011 0110
- Convert each group:
- 1011 = B
- 0110 = 6
Result: Binary 10110110 = Hexadecimal B6
Converting Hexadecimal to Binary
To convert hexadecimal to binary, replace each hex digit with its 4-bit binary equivalent.
Example: Convert hexadecimal D7 to binary:
- Look up each hex digit:
- D = 1101
- 7 = 0111
- Concatenate the binary digits: 1101 0111
Result: Hexadecimal D7 = Binary 11010111
Hexadecimal is used extensively in debugging because it's much more compact than binary. For example, an 8-bit byte (11010111) is simply "D7" in hex.
Binary-Coded Decimal (BCD)
Binary-Coded Decimal (BCD) is a method for representing decimal numbers in digital systems where each decimal digit is encoded separately using 4 binary bits.
Example: Decimal 123 in BCD:
Decimal: 1 2 3 BCD: 0001 0010 0011
Each decimal digit (1, 2, 3) is independently converted to its 4-bit binary equivalent. The complete BCD representation is: 0001 0010 0011
BCD vs. Pure Binary
| Aspect | BCD | Pure Binary |
|---|---|---|
| Decimal 123 | 0001 0010 0011 (12 bits) | 1111011 (7 bits) |
| Efficiency | Less efficient (more bits) | More efficient (fewer bits) |
| Decimal Arithmetic | Easier (digit-by-digit) | Harder (requires conversion) |
| Common Use | Calculators, digital clocks, displays | General computing, memory, processors |
BCD is useful when you need to display decimal numbers directly (like on a 7-segment display) without converting from binary. However, it uses more memory than pure binary representation.
Where is BCD Used? BCD is commonly used in electronic calculators, digital clocks, and measurement instruments where decimal values must be displayed. It simplifies the circuit design for decimal arithmetic and digit-by-digit operations.
Common Beginner Mistakes
Mistake #1: Confusing BCD with pure binary
Wrong: Thinking decimal 123 in BCD is the same as binary 123
Right: BCD encodes each decimal digit separately (0001 0010 0011), while pure binary represents the entire number (1111011)
Why? BCD preserves decimal digit boundaries for easier display and decimal arithmetic.
Mistake #2: Reading decimal-to-binary remainders in the wrong order
Wrong: Reading remainders from top to bottom in decimal-to-binary conversion
Right: Read remainders from bottom to top (reverse order)
Why? The first remainder is the least significant bit (LSB), not the most significant bit (MSB).
Mistake #3: Forgetting to pad binary groups with leading zeros
Wrong: Converting binary 110 1010 directly to hex (3 bits + 4 bits)
Right: Pad to 4-bit groups: 0110 1010 = 6A in hex
Why? Each hex digit requires exactly 4 binary bits.
Mistake #4: Confusing number system bases during calculation
Remember: Binary uses powers of 2, decimal uses powers of 10, hexadecimal uses powers of 16. Don't mix them up during conversions!
Summary
In this tutorial, you learned:
- Number systems use different bases: decimal (base-10), binary (base-2), hexadecimal (base-16)
- Binary is the foundation of all digital systems because it represents two voltage states (0 and 1)
- Conversion between number systems uses systematic algorithms: division/multiplication methods
- Hexadecimal provides a compact way to represent binary data (4 bits = 1 hex digit)
- BCD encodes each decimal digit separately using 4 bits, useful for display applications
- Reading remainders in reverse order is critical for decimal-to-binary conversion