Subnet Calculator
CIDR โ network, broadcast, mask, hosts
๐ No upload โ runs entirely in your browser. Your data never leaves your device.
Understanding CIDR Notation
CIDR โ Classless Inter-Domain Routing โ is the universal language of IP networking. Before CIDR, IP addresses were split into rigid classes: Class A networks used the first 8 bits for the network portion and gave each organization up to 16.7 million addresses, Class B used 16 bits (65,536 addresses), and Class C used 24 bits (256 addresses). The class system wasted enormous chunks of address space and made routing tables bloated.
CIDR, introduced by RFC 1519 in 1993, allows any prefix length from /0 (the entire internet) to /32 (a single host). The notation 192.168.1.0/24 tells you two things: the IP address is 192.168.1.0, and the first 24 bits are the network identifier. The remaining 8 bits (32 โ 24 = 8) are free for host addresses โ 2โธ = 256 total addresses, 254 usable after reserving the network and broadcast addresses.
You will encounter CIDR notation in nearly every networking context: configuring a router or switch interface, writing security group or firewall rules in AWS, Azure, or GCP, defining VPN split-tunneling policies, setting up Docker or Kubernetes pod networking, or assigning IP ranges in a DHCP server. Fluency with CIDR is one of the most practical skills a developer or systems administrator can have.
How to Read the Results
The calculator returns eleven fields for any CIDR input. Here is what each one means and when you need it:
- Network Address โ The first address in the subnet, used to identify the network itself. This address is never assigned to a device. When you type a route into a router (e.g.,
ip route 10.1.0.0/16 ...), you use the network address. - Broadcast Address โ The last address in the subnet. A packet sent to this address is delivered to every host on the subnet. Like the network address, it cannot be assigned to a device (except in /31 subnets per RFC 3021).
- Subnet Mask โ The dotted-decimal representation of the prefix. Use this in legacy systems that do not accept CIDR notation: older operating systems, some printers, and DHCP server configuration files.
- Wildcard Mask โ The bitwise NOT of the subnet mask. Used in Cisco ACLs and OSPF area declarations. A 0 bit means "must match exactly"; a 1 bit means "can be anything."
- First / Last Usable Host โ The range of addresses you can assign to devices. For a /24, that is x.x.x.1 through x.x.x.254.
- Total Addresses / Usable Hosts โ Total includes the network and broadcast address; usable is what is assignable to devices. For /30 and shorter (larger networks), these differ by 2. For /31, they are equal (both 2). For /32, both are 1.
Common Subnet Sizes at a Glance
These are the prefix lengths you will encounter most often in cloud infrastructure, home networks, and enterprise environments:
| Prefix | Subnet Mask | Usable Hosts | Common Use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Large enterprise / Class A |
| /12 | 255.240.0.0 | 1,048,574 | RFC 1918 block (172.16.0.0) |
| /16 | 255.255.0.0 | 65,534 | Class B / medium org |
| /20 | 255.255.240.0 | 4,094 | Cloud VPC subnets (AWS default) |
| /22 | 255.255.252.0 | 1,022 | Campus segment |
| /24 | 255.255.255.0 | 254 | Home / small office / VLAN |
| /25 | 255.255.255.128 | 126 | Split a /24 in half |
| /26 | 255.255.255.192 | 62 | Small team / IoT segment |
| /27 | 255.255.255.224 | 30 | Server cluster |
| /28 | 255.255.255.240 | 14 | Small cloud subnet |
| /29 | 255.255.255.248 | 6 | Very small cluster |
| /30 | 255.255.255.252 | 2 | Routed point-to-point (classic) |
| /31 | 255.255.255.254 | 2 | P2P link (RFC 3021, no broadcast) |
| /32 | 255.255.255.255 | 1 | Host route / loopback |
Real Use Case: Designing AWS VPC Subnets
Cloud networking is where subnet math matters most day-to-day. AWS, GCP, and Azure all require you to define CIDR blocks when creating Virtual Private Clouds (VPCs) and subnets. Here is a worked example of planning a production VPC:
Suppose you create a VPC with CIDR 10.0.0.0/16. That gives you 65,536 addresses (65,534 usable). You want to carve it into subnets across three Availability Zones (AZs), with public subnets for load balancers and private subnets for application servers. A common layout:
10.0.1.0/24โ Public subnet AZ-1 (254 hosts, for NAT gateways and ALBs)10.0.2.0/24โ Public subnet AZ-210.0.3.0/24โ Public subnet AZ-310.0.10.0/22โ Private subnet AZ-1 (1,022 hosts, for EC2/ECS tasks)10.0.14.0/22โ Private subnet AZ-210.0.18.0/22โ Private subnet AZ-310.0.100.0/24โ Database subnet AZ-1 (RDS, ElastiCache)
Notice that the /22 private subnets are aligned on /22 boundaries: 10.0.10.0/22 ends at 10.0.13.255, and 10.0.14.0/22 starts immediately after. Misaligning subnets โ for example, trying to use 10.0.11.0/22 โ wastes addresses and confuses routing. AWS actually reserves five addresses per subnet (network, broadcast, plus three for its own use), so a /28 gives you only 11 usable addresses instead of the expected 14.
Security groups in AWS use CIDR notation to define allowed source or destination ranges. A common mistake is putting 0.0.0.0/0 (all traffic) in an inbound rule during development and forgetting to tighten it. The Subnet Calculator helps you construct precise CIDR ranges โ for example, to allow only your office IP range.
Real Use Case: Home and Office Networks
On a home or small office network, subnet math shows up when configuring routers, setting static IPs, or troubleshooting connectivity. Most home routers default to 192.168.1.0/24 or 192.168.0.0/24, giving 254 usable addresses โ more than enough for any household.
A practical scenario: you have two floors in an office, and you want to segment IoT devices (smart lights, cameras) away from employee laptops. You could split a /23 (510 hosts) into two /24s: 10.1.0.0/24 for staff and 10.1.1.0/24 for IoT. Traffic between the two VLANs can then be filtered by a managed switch or firewall, improving both security and network performance.
When assigning static IPs to servers, printers, or other fixed devices, you need to know the subnet boundaries. If your network is 10.1.0.0/24, valid static IPs run from 10.1.0.1 to 10.1.0.254 โ a mistake like assigning 10.1.1.5 would put the device on a different subnet, and it would be unreachable from the rest of the 10.1.0.0/24 network.
RFC 1918 Private IP Address Ranges
RFC 1918 defines three blocks of IPv4 addresses reserved for private use that are never routed on the public internet:
10.0.0.0/8โ 16,777,216 addresses (10.0.0.0 to 10.255.255.255). Used by large enterprises and cloud VPCs. AWS, GCP, and Azure all default to ranges from this block.172.16.0.0/12โ 1,048,576 addresses (172.16.0.0 to 172.31.255.255). Docker uses 172.17.0.0/16 by default for its bridge network. Less commonly used than the other two ranges.192.168.0.0/16โ 65,536 addresses (192.168.0.0 to 192.168.255.255). The default for home routers worldwide. Most home networks use 192.168.0.0/24 or 192.168.1.0/24.
In addition to RFC 1918, there are two other special ranges to know: 127.0.0.0/8 is the loopback range (127.0.0.1 is "localhost"), and 169.254.0.0/16 is the link-local range (assigned automatically when DHCP fails โ you will see these on Windows as the dreaded "169.254.x.x" address that indicates the device could not reach a DHCP server).
Special Subnets: /31, /32, and /0
Three subnet sizes have special meanings that differ from the standard formula:
/31 โ Point-to-Point Links. RFC 3021 (2000) allows /31 subnets for point-to-point links between two routers. A /31 has exactly 2 addresses and no broadcast address โ both addresses are usable. This saves address space on the countless router-to-router links in carrier networks. On a /31, one IP goes to each router interface; the concept of "network address" and "broadcast" does not apply in the traditional sense. Modern router operating systems (IOS, JunOS, EOS) all support /31 interfaces.
/32 โ Host Routes. A /32 identifies exactly one IP address โ the mask is 255.255.255.255. You will see /32 used for loopback interfaces on routers (every router runs a loopback address for management and OSPF router-ID purposes), for advertising a single IP in BGP, and in firewall rules that apply to one specific host. In AWS, an Elastic IP attached to an ENI appears as a /32 route.
/0 โ Default Route. The /0 prefix covers the entire IPv4 address space. In routing, 0.0.0.0/0 is the default route โ "send traffic anywhere not matched by a more specific route here." It is the catch-all used in internet gateway routing tables and VPN split-tunneling rules. In firewall rules, 0.0.0.0/0 in an inbound rule means "allow from all IPs" โ a configuration that should never appear in production security groups without additional controls.
Common Mistakes and Edge Cases
Host bits set in the network address. A common mistake is writing 192.168.1.5/24 when you mean the network 192.168.1.0/24. The calculator accepts either form โ it masks off the host bits to derive the network address โ but routers and cloud consoles often reject addresses where the host portion is non-zero. Always use the network address (all host bits zero) when defining routes or subnets.
Forgetting reserved addresses in cloud subnets. AWS reserves 5 IP addresses per subnet (not the usual 2). For example, in a /28 (16 total addresses), AWS keeps addresses 0, 1, 2, 3 and 15, leaving only 11 usable. For Lambda functions in a VPC, large /24 subnets are recommended since Lambda pre-warms many ENIs. If you size a subnet too small, ECS tasks or Lambda invocations will fail with network interface allocation errors.
Overlapping subnets. Two subnets overlap if one contains addresses from the other. For example, 10.0.0.0/16 and 10.0.1.0/24 overlap (the /24 is entirely inside the /16). Overlapping subnets cause routing ambiguity and are usually rejected by cloud consoles. When designing a VPC, plan your address space on paper (or in a spreadsheet) before creating subnets, ensuring each CIDR block uses a distinct, non-overlapping range within the parent VPC CIDR.
Confusing subnet mask and wildcard mask. Entering a wildcard mask where a subnet mask is expected (or vice versa) produces incorrect results. If you enter 0.0.0.255 expecting the calculator to treat it as a mask, it will be interpreted as an IP address, not a mask. The calculator works only with CIDR prefix notation (e.g., /24) โ if you have a dotted-decimal mask like 255.255.255.0, convert it by counting the 1 bits: 255 = 8 bits, so 255.255.255.0 = /24.
Frequently Asked Questions
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its associated network mask as a single compact string, for example 192.168.1.0/24. The number after the slash โ called the prefix length โ indicates how many of the 32 bits in the IP address are fixed (the network part), while the remaining bits identify individual hosts within that network. A /24 means the first 24 bits are the network portion and the last 8 bits are free for host addresses, giving 256 total addresses (254 usable). CIDR replaced the older Class A/B/C system because it allows networks of any size, not just fixed 8-, 16-, or 24-bit boundaries. Nearly every router, cloud console, and firewall rule uses CIDR notation today.
How do I calculate the subnet mask from a prefix length?
To convert a prefix length to a dotted-decimal subnet mask, fill the first N bits with 1s and the remaining (32 โ N) bits with 0s, then split the 32-bit number into four 8-bit octets. For example, /24 produces 11111111.11111111.11111111.00000000, which is 255.255.255.0. A /20 produces 11111111.11111111.11110000.00000000, which is 255.255.240.0. The Subnet Calculator above computes this automatically: paste any CIDR address and the mask appears instantly alongside the other fields.
What is the difference between a network address and a broadcast address?
The network address is the first address in a subnet โ it identifies the subnet itself and cannot be assigned to a device. It is calculated by performing a bitwise AND between the IP address and the subnet mask. The broadcast address is the last address in a subnet โ all 1s in the host portion. Any packet sent to the broadcast address is delivered to every device on that subnet. Between these two reserved addresses lie the usable host addresses. For a /24 (256 addresses), the first address (e.g., 192.168.1.0) is the network address, the last (192.168.1.255) is the broadcast address, and 192.168.1.1 through 192.168.1.254 are the 254 usable host addresses.
How many usable hosts does a /24 subnet have?
A /24 subnet has 2^8 = 256 total addresses, of which 254 are usable for hosts. Two addresses are always reserved: one for the network address (first) and one for the broadcast address (last). The formula for usable hosts is 2^(32 โ prefix) โ 2 for prefix lengths of /1 through /30. The special cases are /31, which RFC 3021 allows for point-to-point links with exactly 2 addresses and no broadcast, and /32, which represents a single host. Common sizes: /28 = 14 usable hosts, /27 = 30, /26 = 62, /25 = 126, /24 = 254, /23 = 510, /22 = 1022.
What is a wildcard mask and when is it used?
A wildcard mask is the bitwise inverse (NOT) of a subnet mask. Where the subnet mask has 1s in the network portion, the wildcard mask has 0s โ and vice versa. For a /24 subnet mask of 255.255.255.0, the wildcard mask is 0.0.0.255. Wildcard masks are used primarily in Cisco IOS access control lists (ACLs) and in OSPF area statements, where a 0 bit means "must match" and a 1 bit means "don't care." They are also used in some firewall rules. Unlike subnet masks, wildcard masks do not have to be contiguous โ you can create non-contiguous patterns for advanced traffic filtering, though contiguous masks are by far the most common.
What are the RFC 1918 private IP address ranges?
RFC 1918 defines three blocks of IPv4 addresses reserved for private use that are never routed on the public internet: 10.0.0.0/8 (16,777,216 addresses, covering 10.0.0.0 to 10.255.255.255), 172.16.0.0/12 (1,048,576 addresses, covering 172.16.0.0 to 172.31.255.255), and 192.168.0.0/16 (65,536 addresses, covering 192.168.0.0 to 192.168.255.255). Home and small business networks almost always use 192.168.0.0/24 or 192.168.1.0/24. Cloud providers such as AWS and GCP use the 10.0.0.0/8 range for VPC networks. These ranges are used with NAT so that many devices can share a single public IP.
Can this tool calculate IPv6 subnets?
This tool currently supports IPv4 subnets only. IPv6 uses 128-bit addresses (written as eight groups of four hex digits, e.g., 2001:0db8:85a3::8a2e:0370:7334/64), making the math and display significantly more complex โ the number of total addresses in a /64 alone exceeds 18 quintillion. For IPv6, common prefix lengths include /48 (assigned to organizations), /56 (typical customer allocation), /64 (a single subnet โ the universally recommended size for any LAN segment), and /128 (a single host). IPv6 eliminates the broadcast address concept, replacing it with multicast.
Related Tools
IP Address Lookup
Find your public IP, ISP, city, country, timezone and ASN. Lookup any IP.
Domain Expiry Checker
Check when any domain name expires โ expiry date, days left, registrar and nameservers.
URL Parser
Parse any URL into protocol, host, path, query params and hash.
Base Converter
Convert numbers between binary, octal, decimal and hexadecimal.
Hash Generator
Generate SHA-1, SHA-256 and SHA-512 cryptographic hashes.