Understanding IPv4 Addresses

An IPv4 address is a 32-bit number that uniquely identifies a device on a network. Rather than dealing with raw binary, we represent these 32 bits as four decimal numbers separated by dots, a format called dotted-decimal notation. Each segment is called an octet because it represents 8 bits.

Each octet can hold values from 0 to 255 (since 2^8 = 256 possible values). For example, the address 192.168.1.1 breaks down as:

  • 192 = first octet
  • 168 = second octet
  • 1 = third octet
  • 1 = fourth octet

This dotted-decimal format makes IP addresses readable and memorable for humans. Under the hood, the system sees it as a single 32-bit unsigned integer, but conversion between formats is essential for developers working with APIs, network configuration, and routing.

Four IP Address Representations

An IP address can be expressed in multiple formats. Understanding the conversion between them is crucial for networking tasks. Here are all four representations of 192.168.1.1:

1. Dotted-Decimal Notation

The standard human-readable format:

192.168.1.1

2. Binary (32-bit)

All 32 bits displayed as 0s and 1s:

11000000.10101000.00000001.00000001

Breaking this down: 192 = 11000000, 168 = 10101000, 1 = 00000001, 1 = 00000001

3. Hexadecimal (8 hex characters)

Each octet converted to two hexadecimal digits:

C0A80101

Where C0 = 192, A8 = 168, 01 = 1, 01 = 1

4. Unsigned Integer (32-bit)

The entire 32-bit address as a single decimal number:

3232235777

Calculated as: (192 × 2^24) + (168 × 2^16) + (1 × 2^8) + 1 = 3232235777

Pro Tip: Use our conversion tools to quickly translate between formats: CIDR / IP Converter, IP to Binary, IP to Hex, and Decimal to IP.

Private vs Public IP Ranges (RFC 1918)

Not all IP addresses are accessible from the public internet. The Internet Engineering Task Force (IETF) designated certain address ranges as private, reserved for use within private networks. These ranges cannot be routed across the public internet.

The Three RFC 1918 Private Ranges

  • 10.0.0.0/8 - Provides 16,777,216 addresses. Used for large internal networks.
  • 172.16.0.0/12 - Provides 1,048,576 addresses. Common in enterprise environments.
  • 192.168.0.0/16 - Provides 65,536 addresses. Most common for home and small office networks.

Why Private Ranges Exist

Private IP addresses enable Network Address Translation (NAT), which allows thousands of devices behind a single router to share one public IP address. Your home WiFi router likely uses 192.168.x.x internally while your ISP assigns one public IP to your gateway. This solved the IPv4 exhaustion problem and remains essential for modern networking.

Special IP Addresses

Beyond private and public ranges, several address ranges serve specific purposes:

Loopback Address

The range 127.0.0.0/8 is reserved for loopback, with 127.0.0.1 being the most common. Traffic sent to a loopback address never leaves your machine-it's useful for testing services locally.

Link-Local Addresses

The range 169.254.0.0/16 is auto-assigned to devices when DHCP fails. These addresses are not routable beyond a single network segment.

Broadcast Addresses

The last address in any subnet (e.g., 192.168.1.255 in the 192.168.1.0/24 network) is reserved for broadcast, used to send packets to all devices on a subnet.

Multicast Ranges

Addresses in 224.0.0.0/4 (224.0.0.0 to 239.255.255.255) are reserved for multicast, allowing one-to-many communication.

CIDR Notation Explained

Classless Inter-Domain Routing (CIDR) is the modern way to express IP address ranges and subnet sizes. CIDR notation consists of an IP address followed by a slash and a number: 192.168.1.0/24

Understanding the Prefix Length

The number after the slash is the prefix length-it indicates how many of the 32 bits are the network portion, with the remaining bits being the host portion.

  • /24 means 24 bits are the network, 8 bits are available for hosts
  • /16 means 16 bits are the network, 16 bits are available for hosts
  • /32 means all 32 bits are the network-this is a single address (a host route)

Calculating Host Count

To find how many usable hosts in a subnet, use this formula:

Usable Hosts = 2^(32 - prefix_length) - 2

We subtract 2 because the first address (network address) and last address (broadcast address) are not usable for individual hosts.

Examples:

  • /24: 2^(32-24) - 2 = 2^8 - 2 = 256 - 2 = 254 usable hosts
  • /16: 2^(32-16) - 2 = 2^16 - 2 = 65,536 - 2 = 65,534 usable hosts
  • /30: 2^(32-30) - 2 = 2^2 - 2 = 4 - 2 = 2 usable hosts (often used for point-to-point links)

Subnet Masks and Network Portions

A subnet mask is another way to express which bits are the network portion. It's a 32-bit number where the network bits are 1s and host bits are 0s.

Common CIDR to Subnet Mask Conversions

CIDR Subnet Mask Usable Hosts
/8 255.0.0.0 16,777,214
/16 255.255.0.0 65,534
/24 255.255.255.0 254
/28 255.255.255.240 14
/30 255.255.255.252 2
/32 255.255.255.255 1 (host route)

For a network like 10.0.0.0/8, the first 8 bits (10) represent the network, and the remaining 24 bits can be assigned to hosts. The subnet mask 255.0.0.0 visually shows this: the 255s (11111111 in binary) mark the network portion.

Introduction to IPv6

IPv6 is the successor to IPv4, designed to solve address exhaustion. While IPv4 uses 32 bits, IPv6 uses 128 bits, providing an astronomically larger address space: 2^128 possible addresses.

IPv6 Address Format

IPv6 addresses are written in colon-separated hexadecimal notation, with eight 16-bit groups separated by colons:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

IPv6 Abbreviation Rules

IPv6 addresses are long, so two abbreviation rules exist:

  • Leading zeros can be omitted in each group: 0000 becomes 0
  • One sequence of consecutive all-zero groups can be replaced with :: (used once per address): 2001:db8:85a3::8a2e:370:7334

Special IPv6 Addresses

  • ::1 - Loopback address (equivalent to 127.0.0.1 in IPv4)
  • fe80::/10 - Link-local addresses (auto-assigned on local networks)
  • ::ffff:192.0.2.1 - IPv4-mapped IPv6 addresses (for compatibility)

IPv6 adoption is growing, but IPv4 remains dominant. Modern networks often run dual-stack (both IPv4 and IPv6) for transition and compatibility.

Practical Use Cases for Engineers

VPC and Network Planning

When designing a Virtual Private Cloud (VPC) on AWS, GCP, or Azure, you must choose a CIDR block. A common choice is 10.0.0.0/16, which provides 65,536 addresses. You might then subdivide this into smaller subnets: 10.0.1.0/24 for public services, 10.0.2.0/24 for private databases, and so on.

Firewall and Security Rules

Firewall rules often specify which IPs or CIDR ranges can communicate. For instance, you might allow HTTP traffic from 0.0.0.0/0 (anywhere), but restrict database access to 10.0.0.0/8 (your internal network).

API Rate Limiting and Geolocation

APIs sometimes enforce rate limits or geo-blocking based on IP addresses. Understanding IP ranges helps identify where traffic originates or why a request might be blocked.

DNS and Load Balancing

When you create DNS records, they resolve to IP addresses. Understanding CIDR helps with geo-distributed load balancing and failover strategies.

Quick Reference: Check out our tools for practical IP work: IP Lookup and WHOIS Lookup to find details about any IP address or domain.

Common CIDR Prefixes Reference Table

This table shows commonly used CIDR prefixes and their host capacities:

Prefix Subnet Mask Total Addresses Usable Hosts Common Use
/8 255.0.0.0 16,777,216 16,777,214 Large enterprise networks
/16 255.255.0.0 65,536 65,534 Medium VPC/network
/24 255.255.255.0 256 254 Typical subnet
/28 255.255.255.240 16 14 Small office/lab
/30 255.255.255.252 4 2 Point-to-point links
/32 255.255.255.255 1 1 Single host route

Tools and Resources

Manually converting between IP formats is error-prone. Our online tools help you work with IP addresses efficiently:

Next Steps

Now that you understand the fundamentals of IP addressing and CIDR, deepen your knowledge with our CIDR Subnetting Deep Dive, which covers advanced subnet design, supernetting, and real-world network architecture patterns.

Strong IP knowledge is foundational for cloud engineers, DevOps professionals, system administrators, and anyone building or maintaining modern infrastructure. Use the tools above to practice conversions and solidify your understanding.