🔢 Phase 2 · Fundamentals 🟡 Beginner+ MODULE 05

Number Systems

⏱️ 2 hours
📖 Theory + Conversion Practice
🧩 10 Questions
🔢 Interactive Exercises
Phase 2 progress0%
🎯 What you'll learn: How computers count in binary, converting between binary and decimal, how binary relates to IPv4 addresses, the hexadecimal system, and how hex is used in IPv6 addresses and MAC addresses.

Why Binary?

Computers use binary (base-2) because transistors — the fundamental building blocks of all processors and memory — have exactly two states: on (1) or off (0). Everything a computer stores, processes, or transmits is ultimately represented as a sequence of 1s and 0s.

In networking, this matters most for IP addresses. An IPv4 address is a 32-bit binary number split into four groups of 8 bits called octets. Each octet can represent any value from 0 to 255 (since 2^8 = 256 possible values). Understanding binary lets you understand subnetting, subnet masks, and VLSM.

2
Binary base — digits: 0 and 1
10
Decimal base — digits: 0–9
16
Hex base — digits: 0–9, A–F
32
IPv4 address length in bits
128
IPv6 address length in bits
💡
Why not base-3 or base-10 computers?
Transistors can only be reliably in two states — fully on or fully off. A three-state transistor would require precise voltage thresholds that are easily disrupted by noise and temperature changes. Binary's two states map perfectly to physical reality: high voltage = 1, low voltage = 0. This is why every computer ever built is binary at its core.

Binary Positional Notation

Just like decimal uses powers of 10 for position values (1s, 10s, 100s, 1000s), binary uses powers of 2. Each position in an 8-bit binary number has a fixed value. The leftmost bit is the Most Significant Bit (MSB) with value 128, and the rightmost is the Least Significant Bit (LSB) with value 1.

Position8 (MSB)7654321 (LSB)
Value1286432168421
2^n2⁷2⁶2⁵2⁴2⁰

Binary to Decimal — 5 Worked Examples

To convert binary to decimal: write down the positional values (128, 64, 32, 16, 8, 4, 2, 1), multiply each by the corresponding bit (1 or 0), then add all results.

Binary → Decimal conversions
BINARY
Position:  128  64  32  16   8   4   2   1

Example 1: 11000000 = 192
Bits:        1   1   0   0   0   0   0   0
Values:    128 + 64 +  0 +  0 +  0 +  0 +  0 +  0  = 192

Example 2: 10101000 = 168
Bits:        1   0   1   0   1   0   0   0
Values:    128 +  0 + 32 +  0 +  8 +  0 +  0 +  0  = 168

Example 3: 00000001 = 1
Bits:        0   0   0   0   0   0   0   1
Values:      0 +  0 +  0 +  0 +  0 +  0 +  0 +  1  = 1

Example 4: 11111111 = 255
Bits:        1   1   1   1   1   1   1   1
Values:    128 + 64 + 32 + 16 +  8 +  4 +  2 +  1  = 255

Example 5: 00001010 = 10
Bits:        0   0   0   0   1   0   1   0
Values:      0 +  0 +  0 +  0 +  8 +  0 +  2 +  0  = 10

Decimal to Binary — 5 Worked Examples

To convert decimal to binary using the subtraction method: start with the largest positional value (128). If the decimal number is >= 128, write 1 and subtract; otherwise write 0 and move to the next position. Repeat for each position.

Decimal → Binary conversions
BINARY
Pos:      128  64  32  16   8   4   2   1

Convert 192 → binary
192 >= 128? YES → bit=1, remainder=64
 64 >=  64? YES → bit=1, remainder=0
  0 >=  32?  NO → bit=0 (repeat for 16,8,4,2,1)
Result: 11000000

Convert 168 → binary
168-128=40, 40-32=8, 8-8=0
Result: 10101000

Convert 10 → binary
10 < 128,64,32,16 → 0s. 10>=8: 10-8=2. 2>=2: 2-2=0
Result: 00001010

Convert 172 → binary
172-128=44, 44-32=12, 12-8=4, 4-4=0
Result: 10101100

Convert 255 → binary
255-128=127, 127-64=63, 63-32=31, 31-16=15,
15-8=7, 7-4=3, 3-2=1, 1-1=0
Result: 11111111  (all bits set = maximum value)

IP Addresses in Binary

An IPv4 address is really a 32-bit binary number written as four decimal octets for human readability. The subnet mask is also 32 bits: consecutive 1s identify the network portion, and 0s identify the host portion. Understanding this is the foundation of all subnetting.

IPv4 address in binary — 192.168.10.1
IPv4
IP Address: 192.168.10.1 in binary:
192   = 11000000
168   = 10101000
 10   = 00001010
  1   = 00000001
Full: 11000000.10101000.00001010.00000001

Subnet mask: 255.255.255.0 in binary:
255   = 11111111  <-- network bits (all 1s)
255   = 11111111  <-- network bits
255   = 11111111  <-- network bits
  0   = 00000000  <-- host bits (all 0s)
Full: 11111111.11111111.11111111.00000000
= /24 prefix notation (24 network bits)
32 bits
IPv4 Length
4 octets × 8 bits each. Written as dotted decimal (e.g., 192.168.1.1) for human readability.
0 – 255
Octet Range
8 bits = 2^8 = 256 possible values (0 through 255). 11111111 = 255, 00000000 = 0.
1s = Network
Subnet Mask
1 bits in the subnet mask identify the network portion. 0 bits identify the host portion.
/24 = 255.255.255.0
CIDR Notation
The prefix length counts the consecutive 1 bits in the subnet mask. /24 means 24 ones followed by 8 zeros.
MSB → LSB
Bit Order
Most Significant Bit (128) on the left, Least Significant Bit (1) on the right — same as reading left to right.
AND operation
Network Address
Bitwise AND of IP address and subnet mask = network address. Used by routers to make forwarding decisions.

Hexadecimal (Base-16)

Hexadecimal is base-16, using digits 0–9 and then letters A through F for values 10–15. It is widely used in networking because one hex digit represents exactly 4 bits (a nibble), and two hex digits represent one full byte (8 bits). This makes it far more compact and readable than binary for large values.

You will see hex in: MAC addresses (AA:BB:CC:DD:EE:FF), IPv6 addresses (2001:0DB8:85A3::8A2E:370:7334), and Cisco IOS output throughout your CCNA career.

0
0000
dec: 0
1
0001
dec: 1
2
0010
dec: 2
3
0011
dec: 3
4
0100
dec: 4
5
0101
dec: 5
6
0110
dec: 6
7
0111
dec: 7
8
1000
dec: 8
9
1001
dec: 9
A
1010
dec: 10
B
1011
dec: 11
C
1100
dec: 12
D
1101
dec: 13
E
1110
dec: 14
F
1111
dec: 15
Hex conversions — decimal ↔ hex
HEX
Decimal to Hex (divide by 16, remainders are digits):
255 ÷ 16 = 15 remainder 15F
            15 ÷ 16 =  0 remainder 15F
            Read remainders bottom-up: FF

192 ÷ 16 = 12 remainder 00
            12 ÷ 16 =  0 remainder 12C
            Read bottom-up: C0

172 ÷ 16 = 10 remainder 12CAC
 10 ÷ 16 =  0 remainder 10A0A

Hex to Decimal (multiply each digit by its 16^n position):
FF  = (F × 16) + F = (15 × 16) + 15 = 240 + 15 = 255
C0  = (C × 16) + 0 = (12 × 16) +  0 = 192 +  0 = 192
2A  = (2 × 16) + A = (2  × 16) + 10 =  32 + 10 =  42
MAC address and IPv6 in hexadecimal
HEX
MAC Address: AA:BB:CC:DD:EE:FF
6 bytes = 12 hex digits  (each byte = 2 hex digits)
AA:BB:CC = OUI (manufacturer identifier)
DD:EE:FF = Device ID (unique per NIC)

IPv6 Address (full form):
2001:0DB8:85A3:0000:0000:8A2E:0370:7334
8 groups × 4 hex digits = 128 bits total

IPv6 Abbreviated form (RFC 5952):
2001:DB8:85A3::8A2E:370:7334
Rules: 1) Drop leading zeros in each group
       2) Replace longest run of all-zero groups with ::
       3) :: can only appear ONCE in an address
Quick hex-to-binary trick — convert each digit independently
Convert each hex digit to 4 bits separately — no need to convert to decimal first. So AB hex = 1010 1011 binary. A=1010, B=1011. Just look up each hex digit in the table above and write its 4-bit value. This is especially fast when working with MAC addresses and IPv6.
🧩 Knowledge Check
10 questions — Number Systems
1. What is the decimal value of binary 11000000?
2. What is the binary representation of decimal 168?
3. How many bits are in an IPv4 address?
4. What is the hexadecimal value of decimal 255?
5. How many bits does one hexadecimal digit represent?
6. What is the maximum value of a single octet?
7. Convert 0A hex to decimal:
8. The subnet mask 255.255.255.0 in binary is:
9. IPv6 addresses are how many bits long?
10. What is binary 10101100 in decimal?
Finished this module?
Mark it complete to track your progress.
🎉
Module 5 Complete!
You can now convert between binary, decimal, and hexadecimal — the core skill for all subnetting. Next: the Data Link Layer.
← Course Home
Phase 2 · FundamentalsModule 5 of 17
🗒 Cheat Sheet 📝 Worksheet