IPv4 CIDR Subnet Mask & Equal-Size VLAN Planner Calculator
Interactive CIDR Subnet Mask & Equal-Size VLAN Planner (RFC 4632)
?
Parent CIDR block you were assigned: the /24 from your addressing plan, or the mask shown on the router interface. Choose the prefix that contains every VLAN. Range: /8 to /30 (select).?
Number of VLAN subnets to carve from the parent block: one per VLAN in the plan, including management and transit links. Range: 1 to 128 (units).?
Usable hosts needed in the largest VLAN, already including growth; the calculator does not add it. Read it from the device count or the DHCP pool size. Range: 2 to 65,534 (hosts).?
IPv4 address of the parent block, as four decimal numbers separated by dots (192.168.1.0). A host address inside the block also works: the calculator masks it to the prefix and shows the network that contains it. Leading zeros are not accepted. In the child subnet list, host and broadcast addresses show only the octets that differ from the subnet's network address.?
Optional. Host counts of the subnets you need, separated by commas (100, 50, 20, 2), up to 128 sizes of 1 to 65,534 hosts. The calculator allocates them from the largest down inside the parent, at least a /30 each. Leave it empty to use the equal-size plan above.Use the CIDR Subnet Mask & Equal-Size VLAN Planner (RFC 4632) to evaluate N_hosts = 2^(32 − p) − 2; /31 link = 2 (RFC 3021) | p_vlan = 32 − ⌈log₂(H_max + 2)⌉ for enterprise VLAN segmentation, data center spine-leaf addressing. With the defaults (Parent Network CIDR Prefix = /24, Number of Sub-VLANs Required = 4, Hosts Needed in Largest VLAN = 50) it returns Dotted subnet & wildcard mask: Mask = 255.255.255.0 · Wildcard = 0.0.0.255.
Governing equationN_hosts = 2^(32 − p) − 2; /31 link = 2 (RFC 3021) | p_vlan = 32 − ⌈log₂(H_max + 2)⌉ (IETF RFC 4632 (CIDR) & RFC 1878 (VLSM address tables))
Model assumptions
Default equal-size VLAN plan: every VLAN gets one block sized for the largest VLAN. The host count must already include growth. A plan that uses every block of the parent (100 % used) fits but leaves no room for another VLAN; the status then reads FITS, NO SPARE BLOCK. Parent prefix: /8 to /30. Largest VLAN: 2 to 65,534 hosts. The VLSM list allocates from the largest size down, at least a /30 each. The child list shows at most 32 subnets.
Why Flat /24 Subnets Exhaust Enterprise IPv4 Space and Break OSPF Summarization Boundaries
Allocating uniform /24 (255.255.255.0) blocks to every campus VLAN, router uplink and management loopback is the fastest way to fragment an RFC 1918 private block (10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16) and exhaust it early. Under Classless Inter-Domain Routing (RFC 4632), a subnet of prefix length /P reserves 32 - P host bits, giving 2^(32-P) IPv4 addresses and 2^(32-P) - 2 usable hosts once the all-zeros network identifier and the all-ones broadcast address are excluded.
Beyond address conservation, CIDR alignment decides whether an OSPFv2 (RFC 2328) Area Border Router can summarize many VLANs into one prefix. Eight contiguous /24 VLANs aligned on an 8-subnet boundary (10.40.0.0/24 through 10.40.7.0/24) collapse into one 10.40.0.0/21 summary; unaligned or scattered subnets cannot, and every link flap then floods Type-3 Summary LSAs across the backbone.
| CIDR Prefix | Subnet Mask | Wildcard Mask | Total IPs | Usable Hosts | /24 Equivalents |
|---|---|---|---|---|---|
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 256x /24 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | 128x /24 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | 64x /24 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | 32x /24 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | 16x /24 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | 8x /24 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | 4x /24 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | 2x /24 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | 1x /24 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | 1/2 of /24 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | 1/4 of /24 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | 1/8 of /24 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | 1/16 of /24 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | 1/32 of /24 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | 1/64 of /24 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (RFC 3021, point-to-point links only) | 1/128 of /24 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (single host route) | 1/256 of /24 |
How to Evaluate Bitwise Mask Arithmetic, Wildcard Inverse Masks, and Hierarchical Block Packing Rules?
To avoid overlapping partitions, assign subnets from the largest host requirement down to the smallest. Each child prefix /P_child must start on a multiple of its block size 2^(32 - P_child) inside the parent. A prefix /P becomes the mask M = (0xFFFFFFFF << (32 - P)) & 0xFFFFFFFF, and the ACL wildcard mask is its complement, 2^(32-P) - 1.
This calculator adds no growth buffer, so enter a host count that already includes one: P_opt = 32 - ceil(log2(N_hosts_buffered + 2)). The planner above returns both masks, the network, broadcast and host range of the base address you type, its RFC 1918 class and how many child VLANs fit, and lists the child subnets (the first 32 if there are more). By default every child gets the block size of the largest VLAN. Type host counts separated by commas in the VLSM field and it allocates variable-size subnets from the largest down, at least a /30 each, or says that they do not fit.
| Required Hosts / VLAN | Assigned Sub-Prefix | Usable Hosts / Block | Max Subnets in /24 | Subnet Mask |
|---|---|---|---|---|
| 100 hosts | /25 | 126 | 2 subnets | 255.255.255.128 |
| 50 hosts | /26 | 62 | 4 subnets | 255.255.255.192 |
| 25 hosts | /27 | 30 | 8 subnets | 255.255.255.224 |
| 12 hosts | /28 | 14 | 16 subnets | 255.255.255.240 |
| 5 hosts | /29 | 6 | 32 subnets | 255.255.255.248 |
| 2 hosts | /30 | 2 | 64 subnets | 255.255.255.252 |
Worked Examples: Two Presets Calculated with N_hosts = 2^(32 − p) − 2; /31 link = 2 (RFC 3021) | p_vlan = 32 − ⌈log₂(H_max + 2)⌉
Worked Example 1 (Enterprise /16 with 12 VLANs, 2,000-host largest VLAN): This preset sets Parent Network CIDR Prefix = /16, Number of Sub-VLANs Required = 12, Hosts Needed in Largest VLAN = 2000. Evaluating N_hosts = 2^(32 − p) − 2; /31 link = 2 (RFC 3021) | p_vlan = 32 − ⌈log₂(H_max + 2)⌉ gives: VLANs requested = 12, spare blocks = 20, parent prefix = 16 bits, mask = 255.255.0.0, wildcard = 0.0.255.255, parent IPs = 65536, usable hosts = 65534, VLAN prefix = 21 bits, hosts per VLAN = 2046, maximum VLANs = 32, fit status = FITS CLEANLY, VLAN space used = 37.5 %. Related in the Network, Fiber, PoE & Rack Hub: VPN Tunnel MTU & TCP MSS Clamping Calculator and WAN Bandwidth-Delay Product (BDP) & TCP Window Calculator.
Worked Example 2 (Campus /22 at 100 % fill: 8 VLANs of 110 hosts): This preset shifts the operating inputs to Parent Network CIDR Prefix = /22, Number of Sub-VLANs Required = 8, Hosts Needed in Largest VLAN = 110 to show a full parent: the 110-host VLANs need /25 blocks and the /22 holds 8 of them, so 8 VLANs use 100 % and the status reads FITS, NO SPARE BLOCK. The calculator returns: VLANs requested = 8, spare blocks = 0, parent prefix = 22 bits, mask = 255.255.252.0, wildcard = 0.0.3.255, parent IPs = 1024, usable hosts = 1022, VLAN prefix = 25 bits, hosts per VLAN = 126, maximum VLANs = 8, fit status = FITS, NO SPARE BLOCK, VLAN space used = 100.0 %. You can compare these limits with other calculators in the Engineering Studio.
Step-by-Step Campus IPAM Audit and ACL Wildcard Verification Procedure
When auditing a campus IP Address Management (IPAM) plan, enter the base address, the parent prefix (for example, a /20 with 4,096 addresses) and the host count of the largest VLAN, growth included. Check that the child prefix (such as /23 for 510 usable hosts) divides the parent into a power-of-two number of blocks, then copy the wildcard mask into your OSPF network statements and prefix lists.
Sources
- IETF RFC 4632 · Classless Inter-domain Routing (CIDR)Prefix notation address/P: P is the number of leading significant bits (0 to 32). Basis of 2^(32-P) addresses per block.
- IETF RFC 1878 · Variable Length Subnet Table for IPv4Address counts per prefix: /24 = 256, /27 = 32, /30 = 4. Basis of the parent and VLAN block sizes in the reference tables.
- IETF RFC 3021 · Using 31-Bit Prefixes on IPv4 Point-to-Point LinksA 31-bit prefix leaves only two numbering possibilities on a point-to-point link. Basis of the /31 remark in the prose.
- IETF RFC 1918 · Address Allocation for Private InternetsPrivate blocks 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (section 3). Basis of the private-space check on the base address.
Method and test suite: Calculation Methodology.
Frequently Asked Questions: CIDR Subnet Mask & Equal-Size VLAN Planner (RFC 4632)
Why does a /23 subnet provide 510 usable hosts instead of 508 when combining two /24 networks?
Two /24 networks lose two network IDs and two broadcast addresses, leaving 508 usable hosts. One /23 is a single block of 2^9 = 512 addresses with one of each, so 510 hosts are usable.
When should I deploy a /31 subnet (RFC 3021) instead of a /30 subnet on point-to-point links?
Use /31 only on point-to-point links. RFC 3021 lets both addresses of the 2-address block act as hosts, with no network or broadcast address, but both ends must support 31-bit prefixes. Otherwise use a /30 (4 addresses, 2 usable hosts); on any multi-access segment use a /30 or larger.
How do I calculate the OSPF wildcard mask from a dotted-decimal subnet mask?
Subtract each octet of the subnet mask from 255. A /22 mask of 255.255.252.0 gives the wildcard 0.0.3.255, which matches any address whose top 22 bits are fixed.
What happens if I assign a /22 block starting at 10.1.2.0 instead of 10.1.0.0 or 10.1.4.0?
A /22 spans 4 contiguous third-octet values, so valid boundaries are multiples of 4. Masked with 255.255.252.0, 10.1.2.0 truncates back to 10.1.0.0/22 (the calculator shows it as the network of the address you typed), so routers reject the entry or it overlaps 10.1.0.0/23.