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.00001010

Humans use decimal format instead:

192.168.11.10

So 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:

1234

Each 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
= 1234

Binary Positional Values

Binary uses powers of 2.

Position

Value

2⁷

128

2⁶

64

2⁵

32

2⁴

16

8

4

2

2⁰

1

Example:

Binary:

11000000

Calculation:

1×128 + 1×64 + 0×32 + 0×16 + 0×8 + 0×4 + 0×2 + 0×1
= 192

Binary → Decimal Conversion

Example:

11000000

Binary

Value

1

128

1

64

0

32

0

16

0

8

0

4

0

2

0

1

Add values with 1:

128 + 64 = 192

So:

11000000 = 192

Example IPv4 conversion:

11000000.10101000.00001011.00001010
= 192.168.11.10

Decimal → Binary Conversion

Steps:

  1. Start with 128 column

  2. Ask: Is the number ≥ column value?

  3. If yes → write 1 and subtract

  4. If no → write 0

  5. 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:

10101000

5.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 F

Where:

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: A8

IPv6 and Hexadecimal

IPv6 addresses are:

  • 128 bits long

  • grouped into hextets

Example:

2001:0DB8:AC10:FE01:0000:0000:0000:0001

Each hex digit = 4 bits.


Decimal → Hexadecimal

Steps:

  1. Convert decimal → binary

  2. Divide binary into groups of 4 bits

  3. Convert each group to hex

Example:

Decimal:

168

Binary:

10101000

Groups:

1010 1000

Convert:

1010 = A
1000 = 8

Answer:

168 = A8

Hexadecimal → Decimal

Steps:

  1. Convert hex → binary

  2. Combine into 8-bit groups

  3. Convert binary → decimal

Example:

D2

Binary:

D = 1101
2 = 0010

Combined:

11010010

Decimal:

210

Module 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