Binary Numbers — The Foundation of Computer Networking¶
Every computer, smartphone, router, switch, cloud server, and network device understands only binary numbers—a language made up of 0s and 1s. Although humans use the decimal number system (Base 10), computers use the binary number system (Base 2) because electronic circuits have only two stable states: ON and OFF. Understanding binary numbers is essential for mastering IPv4 addressing, subnetting, Classless Inter-Domain Routing (CIDR), routing, and network design. Every Linux administrator, DevOps engineer, Cloud Architect, Platform Engineer, Site Reliability Engineer (SRE), and Network Engineer must understand binary arithmetic.
Learning Path¶
Course Progress
What You'll Learn¶
After completing this lesson, you'll be able to:
- Understand the binary number system
- Explain bits and bytes
- Convert decimal numbers to binary
- Convert binary numbers to decimal
- Understand binary place values
- Apply binary to IPv4 addressing
- Prepare for subnetting calculations
Prerequisites¶
Complete:
Why Learn Binary Numbers?¶
Every IPv4 address is stored in binary.
Example:
The computer actually stores it as:
Networking devices never process decimal addresses directly—they process binary values.
Without binary, subnetting and routing become impossible to understand.
What is Binary?¶
Binary is a number system that uses only two digits:
It is called a Base-2 Number System.
Why Do Computers Use Binary?¶
Electronic circuits have only two stable states.
Because of this, every piece of digital information is ultimately represented using binary digits.
Number Systems¶
| Number System | Base | Digits |
|---|---|---|
| Decimal | 10 | 0–9 |
| Binary | 2 | 0–1 |
| Octal | 8 | 0–7 |
| Hexadecimal | 16 | 0–9, A–F |
Networking primarily uses:
- Decimal (human-readable)
- Binary (computer-readable)
What is a Bit?¶
A Bit (Binary Digit) is the smallest unit of digital information.
Possible values:
Examples:
What is a Byte?¶
A Byte consists of 8 Bits.
Example:
One byte can represent:
This is why each IPv4 octet ranges from 0 to 255.
Binary Place Values¶
Each bit position has a value.
Example:
Calculation:
Therefore:
Binary Value Table¶
| Binary | Decimal |
|---|---|
| 00000000 | 0 |
| 00000001 | 1 |
| 00000010 | 2 |
| 00000011 | 3 |
| 00000100 | 4 |
| 00000101 | 5 |
| 00000110 | 6 |
| 00000111 | 7 |
Decimal to Binary Conversion¶
Example:
Convert:
Step 1:
Write place values.
Step 2:
Determine which values add up to 13.
Step 3:
Write the binary digits.
Therefore:
Another Example¶
Convert:
Calculation:
Binary:
Binary to Decimal Conversion¶
Example:
Place values:
Calculation:
Therefore:
Practice Conversions¶
Convert the following to binary:
Answer:
Convert:
Answer:
Convert:
Answer:
Convert:
Answer:
Binary in IPv4¶
IPv4 addresses consist of four bytes.
Example:
Binary:
Each section is called an octet.
Why Binary Matters in Networking¶
Binary is used for:
- IPv4 addresses
- Subnet masks
- CIDR notation
- Routing
- Access Control Lists (ACLs)
- Firewall rules
- Network calculations
Every subnetting calculation depends on binary.
Binary and Subnetting¶
Suppose:
Binary:
These binary values determine:
- Network portion
- Host portion
Subnetting is simply binary mathematics.
Real-World Example¶
IP Address:
Subnet Mask:
Routers compare these values in binary to determine:
- Local network
- Remote network
- Routing decisions
Binary Memory Trick¶
Remember the place values:
Always calculate from left to right.
Production Perspective¶
Binary calculations occur continuously in:
- Routers
- Firewalls
- Cloud Platforms
- Kubernetes
- Linux Networking
- Load Balancers
- Virtual Private Networks (VPNs)
- Switches
Although administrators usually see decimal addresses, networking devices always process binary values internally.
Cloud Perspective¶
Cloud providers use binary calculations when:
- Allocating Virtual Private Cloud (VPC) subnets
- Creating route tables
- Configuring firewall rules
- Assigning IP ranges
Understanding binary simplifies cloud networking.
Kubernetes Perspective¶
Kubernetes networking relies heavily on binary when allocating:
- Pod CIDRs
- Service CIDRs
- Node CIDRs
Every cluster network uses binary-based subnet calculations.
Hands-on Lab¶
Task 1¶
Convert the following decimal numbers to binary:
Task 2¶
Convert the following binary numbers to decimal:
Task 3¶
Write the binary representation of your computer's IPv4 address.
Display your IP:
Convert each octet into binary.
Task 4¶
Memorise the binary place values:
Task 5¶
Write the binary equivalent of:
Task 6¶
Identify which bits are set in:
Calculate its decimal value.
Task 7¶
Use an online calculator to verify your manual binary conversions.
Task 8¶
Create a conversion table for every decimal number from 0 to 32 showing its binary representation.
Binary Reference Table¶
| Decimal | Binary |
|---|---|
| 0 | 00000000 |
| 1 | 00000001 |
| 2 | 00000010 |
| 4 | 00000100 |
| 8 | 00001000 |
| 16 | 00010000 |
| 32 | 00100000 |
| 64 | 01000000 |
| 128 | 10000000 |
| 255 | 11111111 |
Common Mistakes¶
❌ Forgetting place values.
✅ Memorise 128, 64, 32, 16, 8, 4, 2, 1.
❌ Reading binary from right to left.
✅ Always evaluate from left to right using place values.
❌ Confusing bits and bytes.
✅ 1 Byte = 8 Bits.
❌ Ignoring leading zeros.
✅ IPv4 octets always contain 8 bits.
❌ Memorising conversions without understanding.
✅ Practice manual calculations regularly.
Best Practices¶
- Learn binary before studying subnetting.
- Practice decimal-to-binary conversions daily.
- Always write all eight bits for IPv4 octets.
- Verify manual calculations until you're confident.
- Understand the logic instead of relying only on calculators.
Interview Questions¶
Beginner¶
- What is binary?
- Why do computers use binary?
- How many bits are in one byte?
- Why does an IPv4 octet range from 0 to 255?
Intermediate¶
- Convert 45 to binary.
- Convert
11001010to decimal. - Explain binary place values.
- Why is binary important in subnetting?
Architect Level¶
- How do routers use binary when making forwarding decisions?
- Explain how binary affects CIDR and VPC subnet design.
- Why is binary knowledge essential for cloud networking and Kubernetes?
Summary¶
In this lesson, you learned:
- The binary number system
- Bits and bytes
- Binary place values
- Decimal-to-binary conversion
- Binary-to-decimal conversion
- Binary representation of IPv4 addresses
- Binary's role in subnetting and routing
Binary is the language of networking. Every IP address, subnet mask, routing table, and firewall rule is ultimately processed as binary. Mastering binary arithmetic makes advanced networking topics such as subnetting, CIDR, Variable Length Subnet Masking (VLSM), and route summarisation much easier to understand.
Key Takeaways¶
- Binary uses only 0 and 1.
- One byte contains 8 bits.
- IPv4 addresses consist of 32 bits (4 bytes).
- Binary place values are 128, 64, 32, 16, 8, 4, 2, 1.
- Binary forms the foundation of IPv4 addressing and subnetting.