CIDR Calculator

CIDR Calculator

Calculate network address, broadcast address, subnet mask, and usable IP range from CIDR notation (e.g., 192.168.1.0/24)

Network Lookup

Format: IP_ADDRESS/PREFIX_LENGTH (0–32)

Network Address
192.168.1.0
Broadcast Address
192.168.1.255
Subnet Mask:255.255.255.0
Usable Range:192.168.1.1192.168.1.254
Usable Hosts:254

About CIDR Notation

CIDR (Classless Inter-Domain Routing) is a modern method for allocating IP addresses and organizing network routing, introduced in 1993 to replace the inefficient classful addressing scheme (Class A, B, C networks). CIDR notation uses the format IP_ADDRESS/PREFIX_LENGTH, where the prefix length indicates how many bits compose the network portion: for example, 192.168.1.0/24 means the first 24 bits identify the network, leaving 8 bits for host addresses. This provides 2&sup8; = 256 total addresses with 254 usable hosts (after excluding the network and broadcast addresses). CIDR enables Variable Length Subnet Masking (VLSM), allowing networks to be subdivided into subnets of arbitrary sizes based on actual requirements, dramatically reducing IP address waste compared to classful networking where entire Class C networks (256 addresses) were the smallest allocatable unit regardless of need. Understanding subnet masks (e.g., 255.255.255.0 for /24) is critical: each octet represents 8 bits, with 1 bits representing network portion and 0 bits representing host portion. Common patterns worth memorizing include /30 (4 addresses, 2 usable) for point-to-point links, /24 (256 addresses, 254 usable) for typical office networks, and /16 (65,536 addresses) for larger enterprises.

Practical CIDR usage requires understanding special address ranges and constraints. Private address space defined by RFC 1918 (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) is non-routable on the public internet, essential for internal networks and NAT scenarios. Route aggregation (supernetting) reduces routing table size by summarizing multiple subnets: for example, four /26 networks can aggregate to a single /24 route. When calculating host capacity, remember that /32 represents a single IP (used in routing tables and firewall rules), /31 provides 2 addresses with no network/broadcast overhead (RFC 3021 for point-to-point links), and /0 theoretically represents the entire IPv4 space. Common pitfalls include forgetting the network/broadcast address overhead (reducing usable hosts by 2 on larger subnets, though /31 and /32 are special cases), misaligning network addresses to subnet boundaries (192.168.1.50/24 is invalid because 1.50 doesn’t align to the /24 boundary), and carelessly subnetting without leaving room for growth. Modern networks often use overlapping /32 host routes in BGP and dynamic prefix lengths (/25 or /27) in data centers to maximize address efficiency and support container orchestration at scale.

Step-by-Step Guide

1Learn the CIDR Notation Format (IP/PREFIX)

CIDR combines a network IP address with a prefix length: 192.168.1.0/24. The IP identifies the network base, and the prefix length indicates how many leading bits represent the network portion. The remaining bits identify individual hosts. For /24, calculation: 32 - 24 = 8 bits for hosts, yielding 2&sup8; = 256 total addresses. Memorize common prefixes: /8 (Class A, 16.7M hosts), /16 (Class B, 65K hosts), /24 (Class C, 256 hosts), /30 (4 addresses for point-to-point).

2Understand Network vs Broadcast vs Usable Addresses

Three critical addresses exist in every subnet: Network address (all host bits = 0) identifies the entire subnet, Broadcast address (all host bits = 1) reaches all hosts at once, and Usable addresses (everything in between) assign to actual devices. For 192.168.1.0/24: network = 192.168.1.0, broadcast = 192.168.1.255, usable = 192.168.1.1 through 192.168.1.254 (254 total). Exception: /31 and /32 special cases where both addresses may be usable for point-to-point links per RFC 3021.

3Calculate Subnet Mask from Prefix Length

Subnet masks represent network bits as 1 and host bits as 0 in binary. For /24: first 24 bits are 1 (11111111.11111111.11111111.00000000 in binary), which equals 255.255.255.0 in decimal. For /22: 22 bits of 1s = 11111111.11111111.11111100.00000000 = 255.255.252.0. For /30: 11111111.11111111.11111111.11111100 = 255.255.255.252. Converting between prefix length and mask: divide prefix by 8 to get full octets, then calculate the partial octet. Use online mask lookup or memorize common conversions to speed up subnetting.

4Apply Network AND Operation to Determine Network Address

Given an IP address and prefix length, the network address emerges from ANDing the IP with the subnet mask (setting all host bits to 0). For example, 192.168.1.50/24 ANDed with mask 255.255.255.0 yields 192.168.1.0. For 10.0.5.100/22 ANDed with 255.255.252.0 yields 10.0.4.0 (note the third octet changes from 5 to 4 because the boundary aligns to multiples of 4). This ensures address alignment; all valid network addresses must align to their prefix boundary. Invalid examples: 192.168.1.50/24 (host bits not zero), 10.0.5.0/22 (not aligned to /22 boundary; should be 10.0.4.0).

5Plan Subnetting Strategy with Aggregation and Routing

When designing networks, use VLSM to allocate appropriately-sized subnets: /24 for office LANs with 250 devices, /26 for smaller departments, /30 for point-to-point router links, /32 for BGP host routes. Aggregate contiguous subnets to reduce routing table size: four sequential /26 networks collapse to a single /24 route. Always verify address alignment before deployment using this calculator. Reserve address space for future growth; assigning /25 to a department of 50 users leaves room for organic growth. Document subnetting decisions for team reference and avoid overlapping private ranges when connecting multiple internal networks via VPN.

Real-World Example

Scenario: Your organization needs to subdivide a corporate /23 network (10.0.0.0/23 providing 510 usable hosts) into department subnets: Finance needs 120 users, Engineering needs 60, Operations needs 30, and Marketing needs 20. Calculate the appropriate CIDR allocation for each department.

Given: Corporate /23 network10.0.0.0/23
Total addresses: 2&sup9; = 512 (510 usable)10.0.0.0–10.0.1.255
Finance dept (120 users): Use /25 (2&sup7; = 128 addresses)10.0.0.0/25
Engineering dept (60 users): Use /26 (2&sup6; = 64 addresses)10.0.1.0/26
Operations (30 users): Use /26 (2&sup6; = 64 addresses)10.0.1.64/26
Marketing (20 users): Use /27 (2&sup5; = 32 addresses)10.0.1.128/27

Interpretation: By using variable-length subnetting, the /23 network efficiently accommodates all four departments with room for growth: Finance gets 126 usable IPs (120 in use + 6 spare), Engineering gets 62 usable, Operations gets 62 usable, Marketing gets 30 usable. This approach wastes minimal address space and aligns department subnets to power-of-2 boundaries for clean routing aggregation. Each subnet’s broadcast address can be used to communicate with all devices in that department.

Frequently Asked Questions

Q: Why is /24 commonly called “Class C”?

In the old classful system (before CIDR), Class C networks were 256 addresses (prefix masks like 255.255.255.0), which corresponds to /24 in modern notation. The term persists in networking for historical reasons, though /24 is now preferred. Class A (/8), Class B (/16), Class C (/24) terminology is largely obsolete but still appears in legacy documentation.

Q: How do two /24 networks differ from one /23?

Two contiguous /24 networks (e.g., 192.168.0.0/24 and 192.168.1.0/24) aggregate into one /23 (192.168.0.0/23). The /23 combines 512 total addresses vs 256 per /24. When subnetting hierarchically, reducing prefix length (e.g., /24 to /23) doubles available addresses; increasing prefix (e.g., /24 to /25) halves them.

Q: What are private IP ranges and why do they matter?

RFC 1918 defines three non-routable private ranges: 10.0.0.0/8 (16.7M addresses), 172.16.0.0/12 (1M addresses), 192.168.0.0/16 (65K addresses). These are reserved for internal networks and won’t route on the public internet. Use them for corporate LANs, data centers, and behind NAT. Never assign public IPs from these ranges; routing will fail.

Q: What’s the difference between /30 and /31 subnets?

/30 subnets have 4 addresses with 2 usable (network + broadcast + 2 hosts), standard for point-to-point router links. /31 subnets have exactly 2 addresses, both usable per RFC 3021, eliminating broadcast address overhead. Modern routers support /31 on point-to-point interfaces, saving one IP per link in large networks.

Q: Why do network addresses end in .0 for /24?

Network addresses must align to subnet boundaries, with all host bits set to 0. For /24, the last octet represents 8 host bits; setting them all to 0 yields .0. For /25, only the last bit is a host bit, so network addresses end in .0 or .128. Misalignment (e.g., 192.168.1.50/24 as a “network address”) violates CIDR notation and causes routing failures.

Q: How do I calculate subnets faster without a calculator?

Memorize powers of 2: /24 = 256, /25 = 128, /26 = 64, /27 = 32, /30 = 4, /31 = 2, /32 = 1. Alternatively, remember for each bit past the octet boundary: -128, -64, -32, -16, -8, -4, -2, -1. For /22, the increment in the third octet is 4; for /26, increment is 64 in the fourth octet. With practice, most common subnetting becomes mental math.

Q: Can I use /32 for a network?

/32 represents a single IP address with no host bits, not a traditional network. It’s commonly used in BGP routing tables to specify a single host route, in firewall rules to target one IP, and in static ARP entries. While technically not a “network,” /32 is valid in routing contexts and essential for DNS resolution and single-host addressing.

Q: What’s the default mask if no prefix is given?

Without an explicit prefix, no standard default applies; CIDR requires explicit notation. In the obsolete classful system, 192.168.x.x defaulted to /16 (Class B) and 10.0.x.x defaulted to /8 (Class A) by first octet. Always specify the prefix explicitly in modern networks (e.g., 10.0.0.0/8) to avoid ambiguity.

Related Tools