Network Subnet / CIDR Planner

Engineer‑grade subnet planning in PHP: enter a CIDR, get canonical network, broadcast, usable range, masks, host counts, and scope; split space with VLSM; detect overlaps; tag and filter allocations; export CSV or JSON; accessible Bootstrap 5 layout, keyboard shortcuts, copy buttons, and cloud‑friendly fields for VLAN, purpose, owner, and region plus DHCP range hints

Calculator
Host bits are canonicalized to the network boundary automatically.

Add to Plan (metadata)
VLSM Planner (IPv4)
Largest-first packing; /31 and /32 handled specially.
Results
Enter a valid CIDR and click Calculate.
Plan & Allocations
Conflicts are highlighted. Utilization shows used/usable hosts when provided.
Parent Block CIDR Usable Used % Util VLAN/VRF Purpose Owner Region/AZ Conflicts

How this Network Subnet / CIDR Planner Works (Formulas & Workflow)

This planner computes IPv4 and IPv6 subnet details, validates boundaries, and helps you plan allocations with VLSM. Below is a concise, engineer‑friendly explanation of the math and the reasoning behind each field that appears in the calculator and the planning table.

IPv4 essentials

Given an IPv4 address and prefix length /p, the netmask is the 32‑bit value whose first p bits are 1s and the rest are 0s. We canonicalize the input by zeroing any host bits: network = ip & mask. The broadcast address is network | (~mask). For traditional subnets (/0 to /30), the first usable host is network+1 and the last usable host is broadcast−1, giving usable hosts = 2^(32−p) − 2. Edge cases: /31 (RFC 3021) has two usable endpoints (no broadcast) and /32 is a single host route. The wildcard mask (useful for ACLs) is simply ~mask. We also identify common private and reserved ranges (10/8, 172.16/12, 192.168/16, 127/8, 169.254/16) to flag scope accurately.

IPv6 essentials

IPv6 uses 128‑bit addresses; there is no broadcast concept. We compute the canonical network by masking to the prefix and show the inclusive start–end span. The number of addresses in a prefix is 2^(128−p), which we display in a human‑readable approximation for very large subnets. Scope cues include Unique Local (fc00::/7), Link‑Local (fe80::/10), Loopback (::1), and Multicast (ff00::/8).

VLSM packing (planner)

The VLSM tool accepts a base IPv4 block and a list of host requirements. It sorts those requirements from largest to smallest, computes the smallest prefix that can fit each requirement (using the same 2^(32−p) − 2 rule, with /31 and /32 handled specially), aligns allocations to proper boundaries, and places each subnet if it still fits inside the base block. Anything unallocated is reported as leftover. You can then push these allocations to the Plan table and tag them with purpose, owner, VLAN/VRF, and region. Conflicts are highlighted automatically via an interval‑overlap check.

ConceptFormula / RuleNotes
Netmask (IPv4) mask = (2^32−1) << (32−p) First p bits set to 1; others 0.
Network network = ip & mask Host bits zeroed (canonicalization).
Broadcast (IPv4) broadcast = network | (~mask) Top of the subnet’s address range.
Usable range (IPv4) [network+1, broadcast−1] For /31, usable = two endpoints; for /32, single host.
Usable hosts (IPv4) 2^(32−p) − 2 Except /31=2 and /32=1.
Wildcard mask (IPv4) wildcard = ~mask Convenient for ACL definitions.
IPv6 span start = network, end = network | (~mask) Inclusive range; no broadcast address exists.
Overlap test !(A.end < B.start || A.start > B.end) Used to flag conflicting allocations.

Worked examples

InputNetworkPrefixRangeUsable HostsNotes
192.168.10.0/24 192.168.10.0 /24 192.168.10.0 — 192.168.10.255 254 Wildcard 0.0.0.255; private scope.
10.0.0.0/31 10.0.0.0 /31 10.0.0.0 — 10.0.0.1 2 Point‑to‑point per RFC 3021; no broadcast.
2001:db8::/64 2001:db8:: /64 2001:db8:: — 2001:db8::ffff:ffff:ffff:ffff 2^64 Standard host subnet size in IPv6.

Planning checklist

  1. Choose a base block (e.g., enterprise 10.0.0.0/8 or a VPC 10.20.0.0/16).
  2. List environments/regions and capacity targets (Prod/Stage/Dev; AZs).
  3. Run the VLSM planner with host counts for each subnet class.
  4. Push allocations to the Plan table and tag with VLAN/VRF, purpose, owner, and region.
  5. Export CSV/JSON for documentation, IaC, or DHCP/firewall templates.

With these formulas and the structured workflow, the planner gives predictable, auditable outcomes for both greenfield and brownfield networks, whether you are sketching a lab, a data‑center VLAN map, or a cloud VPC.

Related Calculators

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.