IP Address in Binary — How IPv4 Addresses Work with Binary
Learn how IPv4 addresses are represented in binary, how subnet masks work, and why networking uses binary. Includes conversion examples and reference table.
Introduction
Every device connected to the internet has an IP address — but did you know that routers and network hardware don’t see 192.168.1.1? They see 32 binary bits: 11000000.10101000.00000001.00000001. Understanding IP addresses in binary is essential for networking courses, subnet calculations, and CCNA/CompTIA exam preparation.
🔧 Convert numbers: Number System Converter — convert any decimal octet (0-255) to binary instantly.
What is an IPv4 Address?
An IPv4 address is a 32-bit number that identifies a device on a network. For human readability, it is written in dotted-decimal notation — four numbers (0-255) separated by dots.
Example: 192.168.1.1
Each number is called an octet because it represents 8 binary bits.
IPv4 Structure
| Component | Decimal | Binary (8 bits) |
|---|---|---|
| Octet 1 | 192 | 11000000 |
| Octet 2 | 168 | 10101000 |
| Octet 3 | 1 | 00000001 |
| Octet 4 | 1 | 00000001 |
| Full Address | 192.168.1.1 | 11000000.10101000.00000001.00000001 |
Total: 4 octets × 8 bits = 32 bits
Common IP Values in Binary
| Decimal | Binary | Usage |
|---|---|---|
| 0 | 00000000 | Network address / any |
| 1 | 00000001 | First host / gateway |
| 127 | 01111111 | Loopback (localhost) |
| 128 | 10000000 | Class B start |
| 192 | 11000000 | Class C start |
| 255 | 11111111 | Broadcast / mask |
| 10 | 00001010 | Private network (10.x.x.x) |
| 168 | 10101000 | Part of 192.168.x.x |
| 172 | 10101100 | Private (172.16-31.x.x) |
Worked Example: Convert 192.168.1.1 to Binary
Step 1: Convert each octet using division-by-2:
192: 192÷2=96R0, 96÷2=48R0, 48÷2=24R0, 24÷2=12R0, 12÷2=6R0, 6÷2=3R0, 3÷2=1R1, 1÷2=0R1 → 11000000
168: → 10101000
1: → 00000001 (pad to 8 bits)
1: → 00000001
Full binary: 11000000.10101000.00000001.00000001
What is a Subnet Mask?
A subnet mask separates the network portion from the host portion of an IP address. Common masks:
| Mask (Decimal) | Mask (Binary) | CIDR | Hosts |
|---|---|---|---|
| 255.0.0.0 | 11111111.00000000.00000000.00000000 | /8 | 16M |
| 255.255.0.0 | 11111111.11111111.00000000.00000000 | /16 | 65,534 |
| 255.255.255.0 | 11111111.11111111.11111111.00000000 | /24 | 254 |
| 255.255.255.128 | 11111111.11111111.11111111.10000000 | /25 | 126 |
Rule: 1-bits = network portion, 0-bits = host portion.
How Subnetting Uses Binary
To find the network address: AND the IP with the subnet mask bit by bit.
Example: IP 192.168.1.130 with mask 255.255.255.128 (/25)
IP: 11000000.10101000.00000001.10000010
Mask: 11111111.11111111.11111111.10000000
AND: 11000000.10101000.00000001.10000000 = 192.168.1.128 (network)
Host part: last 7 bits → this host is .130 in the 192.168.1.128/25 subnet.
Why Binary Matters for Networking
- Subnet calculations — all done in binary using AND operations
- CIDR notation — /24 means “first 24 bits are network”
- Routing decisions — routers compare binary prefixes
- Access Control Lists (ACLs) — wildcard masks use inverse binary
- Exam questions — CCNA, CompTIA Network+, GATE all test binary IP operations
Common Mistakes
- Forgetting to pad to 8 bits — decimal 1 must be 00000001, not just 1
- Confusing subnet mask 1s with network bits — consecutive 1s from the left only
- Wrong broadcast address — set all host bits to 1, not the full address to 255
- Mixing up network/host portions — mask tells you the boundary
- Forgetting private vs public ranges — 192.168.x.x, 10.x.x.x, 172.16-31.x.x are private
Frequently Asked Questions
How many bits is an IPv4 address?
32 bits total, divided into 4 octets of 8 bits each. This gives a total of 2³² = 4,294,967,296 possible addresses.
Why is 255.255.255.255 used as broadcast?
All host bits set to 1 means “send to all hosts on this network.” 255 = 11111111 in binary (all bits on).
What is CIDR /24?
/24 means the first 24 bits are the network portion, leaving 8 bits for hosts. This equals subnet mask 255.255.255.0 and allows 254 usable host addresses.
How do I find how many hosts a subnet supports?
Count the number of 0-bits in the subnet mask. Hosts = 2ⁿ − 2 (subtract network and broadcast addresses). For /24: 2⁸ − 2 = 254 hosts.
What is the difference between IPv4 and IPv6?
IPv4 uses 32-bit addresses (4 billion). IPv6 uses 128-bit addresses (340 undecillion) written in hexadecimal groups. IPv6 was created because IPv4 ran out of addresses.
Related Calculators
Related Articles
Free tools
Learn faster with Numverto
Free number system converters, binary tools, EMI calculators, and more, with step-by-step working.
Written by
Numverto Editorial Team
Founder of Numverto. MCA graduate, full-stack developer, and lifelong learner who built this platform so every student gets the explanation, not just the answer.
Related tools
More from Numverto Blog
ieee754
IEEE 754 Floating Point Explained Sign, Exponent & Mantissa
Master IEEE 754 floating point format sign, exponent, mantissa explained with real conversion examples for exams and coding interviews.
13 July 2026
IEEE 754 Standard
Why Does 0.1 + 0.2 Equal 0.30000000000000004? Floating-Point Errors Explained
Understand why computers produce floating-point precision errors, how the IEEE 754 standard stores decimal numbers in binary, why rounding occurs, and the best practices developers use to write accurate, reliable code.
1 July 2026
Discussion