Module 5
Number Systems
Module Objective
Learn how to convert numbers between Decimal, Binary, and Hexadecimal.
These number systems are important in networking because computers use binary, while humans usually use decimal.
5.1 Binary Number System
What is Binary?
Binary is a base-2 number system that uses only:
0
1
These digits are called bits.
Computers, routers, and other networking devices communicate using binary numbers.
Binary and IPv4 Addresses
An IPv4 address is written using:
32 bits total
divided into 4 groups (octets)
each octet = 8 bits
Example (Binary IPv4):
11000000.10101000.00001011.00001010Humans use decimal format instead:
192.168.11.10So networking professionals must know how to convert binary ↔ decimal.
Positional Notation
In any number system, the value of a digit depends on its position.
Decimal (Base 10)
Example:
1234Each position represents a power of 10:
Position | Value |
|---|---|
10³ | 1000 |
10² | 100 |
10¹ | 10 |
10⁰ | 1 |
Calculation:
1×1000 + 2×100 + 3×10 + 4×1
= 1234Binary Positional Values
Binary uses powers of 2.
Position | Value |
|---|---|
2⁷ | 128 |
2⁶ | 64 |
2⁵ | 32 |
2⁴ | 16 |
2³ | 8 |
2² | 4 |
2¹ | 2 |
2⁰ | 1 |
Example:
Binary:
11000000Calculation:
1×128 + 1×64 + 0×32 + 0×16 + 0×8 + 0×4 + 0×2 + 0×1
= 192Binary → Decimal Conversion
Example:
11000000Binary | Value |
|---|---|
1 | 128 |
1 | 64 |
0 | 32 |
0 | 16 |
0 | 8 |
0 | 4 |
0 | 2 |
0 | 1 |
Add values with 1:
128 + 64 = 192So:
11000000 = 192Example IPv4 conversion:
11000000.10101000.00001011.00001010
= 192.168.11.10Decimal → Binary Conversion
Steps:
Start with 128 column
Ask: Is the number ≥ column value?
If yes → write 1 and subtract
If no → write 0
Continue until 1 column
Example: Convert 168 to Binary
Value | Result |
|---|---|
128 | 1 (168-128=40) |
64 | 0 |
32 | 1 (40-32=8) |
16 | 0 |
8 | 1 |
4 | 0 |
2 | 0 |
1 | 0 |
Binary:
101010005.2 Hexadecimal Number System
What is Hexadecimal?
Hexadecimal is a base-16 number system.
It uses:
0 1 2 3 4 5 6 7 8 9 A B C D E FWhere:
Hex | Decimal |
|---|---|
A | 10 |
B | 11 |
C | 12 |
D | 13 |
E | 14 |
F | 15 |
Why Networking Uses Hexadecimal
Hexadecimal is used to represent:
IPv6 addresses
MAC addresses
Because it is shorter and easier to read than binary.
Example:
Binary: 10101000
Hex: A8IPv6 and Hexadecimal
IPv6 addresses are:
128 bits long
grouped into hextets
Example:
2001:0DB8:AC10:FE01:0000:0000:0000:0001Each hex digit = 4 bits.
Decimal → Hexadecimal
Steps:
Convert decimal → binary
Divide binary into groups of 4 bits
Convert each group to hex
Example:
Decimal:
168Binary:
10101000Groups:
1010 1000Convert:
1010 = A
1000 = 8Answer:
168 = A8Hexadecimal → Decimal
Steps:
Convert hex → binary
Combine into 8-bit groups
Convert binary → decimal
Example:
D2Binary:
D = 1101
2 = 0010Combined:
11010010Decimal:
210Module 5 Key Points
• Binary = base 2 (0 and 1)
• Decimal = base 10 (0-9)
• Hexadecimal = base 16 (0-9 + A-F)
• IPv4 uses binary but written in decimal
• IPv6 and MAC addresses use hexadecimal
• Conversions often follow this pattern:
Decimal ↔ Binary ↔ Hexadecimal