Skip to main content
Back to Developer Tools

CIDR Calculator

Subnet mask, IP range calculation and network planning tool

IP Address
Subnet Division
Common CIDRs
CIDR Calculation Results

Enter IP address and prefix length to start calculation

CIDR Knowledge

What is CIDR?

CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and performing IP routing. It uses prefix length to represent the size of the network portion, replacing traditional A, B, C class network divisions.

Subnet Mask

Subnet mask is used to distinguish the network portion and host portion in an IP address. The shorter the prefix length, the larger the network and more hosts; the longer the prefix length, the smaller the network and fewer hosts.

Subnet Division

Subnet division is the process of dividing a large network into multiple smaller sub-networks, which can improve network security, reduce broadcast domains, and optimize network performance. Consider actual requirements when dividing subnets.

Private IP Addresses

Private IP addresses include: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. These addresses can only be used within internal networks and cannot be directly routed on the Internet.

CIDR calculation formula
CIDR results are derived by converting IPv4 addresses and subnet masks into 32-bit values, then applying bitwise operations.
Subnet mask = 32-bit mask with prefix bits set to 1
Network address = IP address AND subnet mask
Wildcard mask = NOT subnet mask
Broadcast address = Network address OR wildcard mask
Total addresses = 2^(32 - prefix)
Usable hosts = Total addresses - 2, except /31 and /32 special cases
prefix
CIDR prefix length
The number after the slash, such as 24 in 192.168.1.0/24.
AND
Bitwise AND
Keeps address bits that are inside the network portion of the subnet mask.
OR
Bitwise OR
Combines the network address with the wildcard mask to find the broadcast address.
/31 and /32
Point-to-point and single-host exceptions
/31 networks can have 2 usable endpoint addresses, while /32 identifies one exact host address.
How this CIDR calculator works
The calculator focuses on IPv4 subnet math for everyday network planning, documentation, firewall rules, and cloud VPC checks.
  1. Validate that the IP address is a dotted IPv4 address and that the prefix length is between 0 and 32.
  2. Convert the IPv4 address into a 32-bit integer so subnet operations can be calculated consistently.
  3. Build the subnet mask from the prefix length, then calculate the wildcard mask, network address, and broadcast address.
  4. Calculate total and usable host counts, including the /31 and /32 edge cases used in point-to-point or host routes.
  5. For subnet division, compare the original prefix with the new prefix and enumerate each smaller subnet range.

Important notes

  • The tool does not validate whether a range is routable on your specific cloud, router, firewall, or ISP.
  • Overlapping CIDR blocks can break routing plans even when each individual subnet calculation is correct.
  • IPv6 CIDR planning uses a different address size and is not covered by this IPv4 calculator.
CIDR examples
Use these examples to sanity-check common subnet planning situations before applying them to production networks.

Small office LAN

A team needs one private subnet for laptops, printers, and local services.

  • IP address: 192.168.1.10
  • Prefix length: /24

Network: 192.168.1.0/24, usable hosts: 254

A /24 is easy to operate for a small LAN, but it may be larger than needed for segmented networks.

Cloud application subnet

A VPC needs separate smaller ranges for web, app, and database tiers.

  • Original network: 10.0.0.0/24
  • New prefix length: /26

Four /26 subnets, each with 62 usable hosts

Subnet division helps reserve address space while keeping tiers isolated.

Point-to-point link

Two router interfaces need an address pair without wasting a /30.

  • IP address: 203.0.113.0
  • Prefix length: /31

Usable hosts: 2

A /31 can be valid for point-to-point links, but confirm device and provider support.

CIDR FAQ
Common checks for subnet masks, host counts, and production use.