Skip to the content.
24 August 2026

In modern networking, understanding how IP addresses are structured, allocated, and routed is crucial for software engineers, systems administrators, and DevOps practitioners. This guide breaks down the core concepts of IP subnetting, Classless Inter-Domain Routing (CIDR), and the underlying mathematical operations that make networking tick.

Whether you are configuring cloud VPC security groups, troubleshooting router rules, or setting up host firewalls, these concepts form the foundation of secure and efficient infrastructure.


What is an IP Address?

An IPv4 address is a 32-bit numeric identifier assigned to every device connected to an IP network. For human readability, we express these 32 bits as four decimal numbers separated by dots (e.g., 192.168.1.1). Each of these four numbers is called an octet because it represents exactly 8 bits.

An IP address consists of two distinct segments:

  1. Network ID: Identifies the specific network or subnetwork.
  2. Host ID: Identifies the unique device (or interface) on that network.

To divide these segments, networks use a subnet mask.


Subnet Masks Explained

A subnet mask is also a 32-bit sequence, composed of consecutive 1s followed by consecutive 0s. The 1s define the network portion of the address, while the 0s define the host portion.

For example, a subnet mask of 255.255.255.0 in binary is: 11111111.11111111.11111111.00000000 (24 ones and 8 zeros).

When paired with 192.168.1.50, this mask indicates:


What is CIDR Notation?

Before CIDR (Classless Inter-Domain Routing) was introduced in 1993, IP addresses were allocated in rigid “classes” (Class A, B, and C), which led to massive inefficiencies. CIDR replaced classful networks with a flexible routing suffix system.

CIDR notation appends a slash (/) and a decimal number to the IP address. The number denotes the count of network-identifying bits (the number of leading 1s in the subnet mask).


Calculating Subnet Details Mathematically

Let’s calculate the details of a subnet block: 192.168.10.34/26.

  1. Subnet Mask: A /26 prefix means 26 ones and 6 zeros. 11111111.11111111.11111111.11000000 = 255.255.255.192
  2. Total Hosts: The formula is 2^(32 - prefix). Here, 2^(32-26) = 2^6 = 64 addresses.
  3. Usable Hosts: We must subtract 2 from the total hosts.
    • Network Address: The first address in the block (all host bits are 0). Used to represent the subnet itself.
    • Broadcast Address: The last address in the block (all host bits are 1). Used to send data to all hosts on the subnet.
    • Formula: 2^(32 - prefix) - 2. In our example, 64 - 2 = 62 usable hosts.
  4. Network Address: Match the IP against the mask using a bitwise AND operation.
    • IP 34 in binary is 00100010.
    • Mask 192 in binary is 11000000.
    • 00100010 AND 11000000 = 00000000 = 0
    • Network Address: 192.168.10.0.
  5. Usable IP Range: 192.168.10.1 to 192.168.10.62.
  6. Broadcast Address: Set all 6 host bits to 1.
    • 00000000 OR 00111111 = 00111111 = 63
    • Broadcast Address: 192.168.10.63.

Simplify with Interactive Calculators

Doing binary math by hand is useful for certifications, but in everyday cloud and infrastructure engineering, automation is preferred. We have developed two high-performance tools to run these calculations safely and instantly inside your browser:

By keeping these calculations local inside client-side memory, these tools ensure that your corporate IP schemas and internal networking plans are never uploaded to a remote server.