CIDR / Subnet Calculator — Free Online IP Subnet Calculator
Calculate CIDR notation, subnet masks, network/broadcast addresses, host ranges, and binary representations. Split networks into subnets or aggregate CIDRs into supernets. Supports both IPv4 and IPv6. 100% client-side — nothing is sent to any server.
What is CIDR notation? CIDR notation writes an IP block as an address followed by a slash and the number of leading bits that are fixed for the network, as in 192.168.1.0/24. Those 24 fixed bits leave 8 host bits, so the block holds 2⁸ = 256 addresses and 254 usable hosts once the network and broadcast addresses are excluded. Defined in RFC 4632, it replaced the old Class A/B/C system and allows a block of any power-of-two size.
How to Use the CIDR / Subnet Calculator
-
Enter a block on the IPv4 tab — Type any address with a prefix —
10.0.0.0/8,192.168.1.130/24,203.0.113.64/26. Results update as you type, and host bits are masked away automatically, so any address inside a block resolves to the block itself. - Read the boundaries — Network address, broadcast address, first and last usable host, and total against usable address counts are listed together. The Type row labels private, loopback, link-local, multicast and benchmarking ranges, so you can tell routable space from reserved space at a glance.
- Check the binary panel — The right-hand panel prints the address, the mask and the network in dotted binary, grouped in nibbles. It is the quickest way to see where the prefix boundary actually falls inside an octet, which matters for anything narrower than a /24.
- Split a block on the Subnet Division tab — Enter the parent CIDR, choose a target prefix between /25 and /32, then press Calculate. Every child subnet is listed with its own host range. Keep the split modest — dividing a /16 into /32s asks the page to render 65,536 rows.
- Aggregate blocks on the Supernet tab — Paste two or more CIDRs, one per line. The tool returns the smallest single block that contains all of them, plus an efficiency percentage showing how much of that block your input actually covers.
- Copy the output — Copy Results writes the full breakdown to the clipboard as plain text for a ticket or change request, and the Common Subnets tab has its own copy button for the whole /8 to /32 reference table.
How CIDR Notation and the Subnet Maths Work
CIDR — Classless Inter-Domain Routing, specified in RFC 4632 — removed the assumption that the size of a network could be read from the first octet of its address. Under the old classful scheme a 200.x address was always a 256-address Class C and a 10.x address was always a 16-million-address Class A, which wasted enormous amounts of space. In CIDR the block states its own boundary: the number after the slash is how many of the 32 bits are fixed. Any prefix from /0 to /32 is legal, so an allocation can be sized to what an organisation actually needs.
Every figure on the IPv4 tab comes from three bitwise operations on the address in its 32-bit integer form. The mask is a run of ones followed by a run of zeros, built by shifting:
mask = 0xFFFFFFFF << (32 − prefix)The network address keeps the bits the mask covers and clears the rest, the broadcast address sets every host bit to one, and the wildcard mask is simply the mask inverted:
network = ip AND mask · broadcast = network OR NOT mask · wildcard = NOT mask
That is why typing 192.168.1.130/24 reports a network of 192.168.1.0: the host bits are masked away, so any address inside a block describes the same block. The binary panel shows those three values eight bits at a time, which makes the boundary visible — everything to the left of the final 1 in the mask row is fixed, and everything to the right of it varies.
Why usable hosts is two fewer than total addresses
In a conventional subnet the all-zeros host address names the network itself and the all-ones address is the directed broadcast, so neither can be assigned to an interface. A /24 therefore holds 256 addresses but only 254 usable ones. Two prefixes are exceptions, and this calculator handles both: a /32 is a single host route with one usable address, and a /31 under RFC 3021 has both of its addresses usable because a point-to-point link has nowhere to broadcast to. For every prefix from /0 to /30 the arithmetic is 2^(32 − prefix) − 2.
Supernetting and route aggregation
The Supernet tab runs the process in reverse. It parses each line, then walks the prefix length downwards to find the longest prefix at which every block masks to the same network, and reports that as the smallest enclosing CIDR. Four consecutive /24s starting at 192.168.0.0 aggregate to 192.168.0.0/22 — one route where there were four, which is the everyday reason for summarising in BGP and OSPF. The efficiency figure divides the addresses in your input lines by the addresses in the supernet, so 100% means the blocks are contiguous and correctly aligned, and a low percentage means the summary sweeps in a lot of space you did not list. Alignment is the catch: 192.168.1.0/24 and 192.168.2.0/24 sit next to each other but do not share a /23 boundary, so they summarise to a /22 that also swallows 192.168.0.0/24 and 192.168.3.0/24.
IPv6 prefixes
IPv6 uses the same slash notation over 128 bits, and the counts get large enough that the tool computes them with JavaScript BigInt instead of 32-bit integers. The total is 2^(128 − prefix), and nothing is subtracted because IPv6 has no broadcast address. The sizing conventions also differ from IPv4: a /64 is the standard size for one LAN, because stateless address autoconfiguration expects 64 interface-identifier bits, while /56 and /48 are typical site allocations and /32 is a common regional or ISP allocation. The IPv6 tab reports the prefix length, the total address count and the allocation tier that prefix normally corresponds to.
IPv4 Prefix Reference
The Common Subnets tab generates this table in full from /8 to /32. The rows below are the prefixes that come up most often in subnet design; block size is the address step between one subnet and the next, which is the number you add to walk from one network address to the following one.
| Prefix | Subnet mask | Wildcard | Total addresses | Usable hosts |
|---|---|---|---|---|
/8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
/16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
/20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
/22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
/24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
/25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
/26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
/27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
/28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
/29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
/30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
/31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (RFC 3021) |
/32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (host route) |
Reserved and Private IPv4 Ranges
The Type row on the IPv4 tab checks the address against the ranges below and prints a label; anything that matches none of them is reported as Public. Knowing which bucket an address falls into usually answers the first question in a connectivity problem — an interface that has drifted to a 169.254 address never got a DHCP lease, and a 127.x destination is never going to leave the host.
| Range | Label shown | What it is for |
|---|---|---|
0.0.0.0/8 | This Network | Reserved as a source-only "this network" identifier |
10.0.0.0/8 | Private | RFC 1918 private space — the largest of the three |
127.0.0.0/8 | Loopback | Traffic never leaves the host |
169.254.0.0/16 | Link-Local | APIPA self-assignment when DHCP fails |
172.16.0.0/12 | Private | RFC 1918 space covering 172.16 to 172.31 |
192.168.0.0/16 | Private | RFC 1918 space, the usual home and lab range |
198.18.0.0/15 | Benchmarking | RFC 2544 device-testing range, not routable |
224.0.0.0/8 | Multicast | Group addressing rather than a single host |
255.255.255.0/24 | Broadcast | Includes the limited broadcast 255.255.255.255 |
The IP Class and Default Mask rows describe the historical classful reading of the first octet. They are shown because certification exams and older device documentation still use them, but they have no effect on modern routing — the prefix you typed is what determines the network boundary.
Frequently Asked Questions
It is the prefix length: the number of leading bits that identify the network rather than the host. A /24 fixes 24 of the 32 bits, leaving 8 host bits and therefore 256 addresses from x.x.x.0 to x.x.x.255. Each extra bit halves the block, so a /25 has 128 addresses and a /26 has 64. Going the other way, a /23 has 512.
The first address in a conventional subnet is the network address and the last is the directed broadcast, and neither can be assigned to an interface, so 256 total addresses give 254 usable ones. Two prefixes break the pattern. A /32 is a single host route and counts one usable address. A /31 counts two, because RFC 3021 allows both addresses of a point-to-point link to be assigned — there is no broadcast to reserve.
They are bitwise inverses of each other. A subnet mask marks the network bits with ones, so a /26 is 255.255.255.192. The wildcard mask marks the bits that are allowed to vary, so the same /26 is 0.0.0.63. Cisco access lists and OSPF network statements take the wildcard form, which is why the calculator prints both — copying the wrong one is a common cause of a rule that silently matches nothing.
It is the merging of several adjacent blocks into one larger block so a router advertises a single route instead of many. The Supernet tab finds the smallest CIDR that contains every network you paste in. Aggregation only collapses cleanly when the blocks are contiguous and aligned to a power-of-two boundary; if they are not, the enclosing block covers address space you did not list, and the efficiency percentage tells you how much.
No. All of the parsing and arithmetic runs in JavaScript in your browser, and no request carries your input. One thing to know: the IPv4 field is also written into the page URL so a calculation can be bookmarked or shared. That is local to your address bar, but it does mean the block you looked up travels with the link if you paste it into a chat or a ticket.
The Subnet Division dropdown offers those targets only, so the tab is aimed at carving a /24 or larger into LAN-sized pieces rather than at chopping a /8 into /16s. Every resulting subnet is rendered as its own row, so also keep the count in mind: a /16 split into /28s is 4,096 rows, and a /8 split into /32s would be over sixteen million and will lock up the tab.
The notation is identical but the sizing conventions are not. A /64 is the normal size for a single IPv6 LAN because stateless address autoconfiguration expects 64 interface bits, so you subnet at /64 rather than sizing to host count. Sites are typically given a /56 or /48, and ISPs a /32. There is no broadcast address, so nothing is subtracted from the total, and the counts are calculated with BigInt because they exceed what a 32-bit integer can hold.
The IPv4 parser needs four dot-separated octets each between 0 and 255, a single slash, and a prefix between 0 and 32 — so 192.168.1.0 with no slash, 192.168.1.0/33, and 192.168.1.256/24 are all rejected. A bare address is not assumed to be a /32. If the input parses but the network address comes back different from what you typed, that is not an error: host bits were set, and the tool masked them off to show the block the address belongs to.
Use Cases
Carving a Cloud VPC Into Subnets
Take the /16 you allocated to a VPC, split it on the Subnet Division tab, and hand the resulting blocks to public, private and database tiers across availability zones — with the exact first and last host of each written down before you touch Terraform.
Checking Two Networks Do Not Overlap
Before a site-to-site VPN or a VPC peering, expand both sides to their first and last address and compare the ranges. Overlapping RFC 1918 space is the single most common reason a tunnel comes up and then routes nothing.
Diagnosing an Unreachable Host
Paste the address and mask a machine actually has and see which block it lands in. A host outside the range it should be in, or one that has fallen back to 169.254, explains a failure faster than another round of pings.
Writing ACLs and Firewall Rules
Read the wildcard mask straight off the IPv4 tab for a Cisco access list or an OSPF network statement, and use the same block in a cloud security group where the rule wants CIDR form instead.
Summarising Routes for BGP or OSPF
Paste the customer prefixes you are advertising into the Supernet tab to see whether they collapse into one announcement, and use the efficiency figure to check the summary is not claiming space that belongs to someone else.
Studying for a Networking Exam
Work a subnetting question by hand, then check the mask, broadcast and host range against the calculator — and use the binary panel to see why the boundary of a /27 falls where it does instead of memorising the table.