IPv4 Subnet Calculator
IPv4 Subnet Calculator
Calculate network, broadcast, host range, and subnets from CIDR or netmask.
IPv4 Subnet Calculator Tool
How to use the IPv4 subnet calculator
Enter your network
Type a CIDR like 192.168.1.0/24 or an IP with netmask like 10.0.0.0 255.255.255.0 — both forms work and auto-detect.
Read the breakdown
The dark result card shows the network address, broadcast, first and last usable host, the total and usable address counts, netmask, wildcard mask, binary representation, and which special-purpose range (private, shared, documentation, loopback…) the block falls in. A /31 shows no broadcast, because RFC 3021 makes both of its addresses hosts.
Copy what you need
Every field has a Copy button. The CIDR is copy-ready in the format most cloud consoles (AWS VPC, GCP, DigitalOcean, AlibabaCloud) accept directly.
Try the presets
The pills under the input cover the three RFC 1918 private ranges, CGNAT 100.64.0.0/10, a sample Singapore APNIC public allocation and a /31 point-to-point link, so you can see how each behaves. Use Split into to list the smaller subnets inside the block.
IPv4 subnetting — the math behind the netmask
An IPv4 address is a 32-bit number. We write it in the friendly "dotted-quad" form (192.168.1.42) but underneath it is just four bytes packed in a row. The netmask — also 32 bits — is what tells the routing layer which part of those bits is the network identifier and which part is the host identifier. The CIDR notation /24 means "the first 24 bits are network, the last 8 bits are host" — equivalent to a netmask of 255.255.255.0. Every subnet calculation is a deterministic application of bitwise AND, OR and NOT against that mask.
Why CIDR replaced classes
Before 1993, IPv4 was split into rigid "classes" — Class A used the first byte for the network (about 16.7 million hosts each), Class B used two bytes, Class C used three. The problem was waste: a company that needed 500 IP addresses was given a full Class B (65,534 hosts) because Class C maxed out at 254. CIDR — Classless Inter-Domain Routing — broke the rigid boundaries and let networks be sized to any power of two. A /22 carved out 1,022 usable hosts, exactly fitting that 500-user company without the wasted 65,000 addresses. CIDR is why IPv4 has survived as long as it has.
The three private ranges and CGNAT
RFC 1918 reserves three IPv4 ranges for private use — addresses that won't be routed on the public internet. They are 10.0.0.0/8 (the giant one, used by most corporate networks), 172.16.0.0/12 (Docker's default for many setups), and 192.168.0.0/16 (home routers). In 2012, RFC 6598 set aside a separate block — 100.64.0.0/10, "shared address space", not an RFC 1918 range — specifically for Carrier-Grade NAT (CGNAT), where ISPs share one public IP among many subscribers. If your home router's WAN address falls between 100.64.0.0 and 100.127.255.255, you are behind CGNAT — your ISP didn't give you a dedicated public IP, and incoming connections won't reach you without a relay or IPv6.
Singapore and APNIC allocations
The five regional internet registries (RIRs) allocate IPv4 blocks to ISPs. Singapore, Malaysia, Indonesia, Thailand, and the rest of Asia-Pacific are served by APNIC (apnic.net), headquartered in Brisbane. APNIC's registry shows, for example, 203.116.0.0 registered to StarHub Internet and 118.200.0.0/16 to SingNet, both Singapore — you can look any block up in APNIC's RDAP service. Those two records carry the netnames STARHUBINTERNET-SG and SINGNET-SG: APNIC netnames commonly end with the country code rather than start with it. IANA's own free pool ran out on 3 February 2011, when its last five /8 blocks went one to each regional registry. APNIC has since rationed IPv4 from its final /8, 103.0.0.0/8: a member can now receive at most a /23 (512 addresses), and anything larger comes through a transfer — or IPv6.
Why the broadcast and network can't be used
In a /24 like 192.168.1.0/24, the addresses .0 and .255 are reserved. The all-zeros host part (.0) is the network identifier — used by routers to refer to the subnet itself. The all-ones host part (.255) is the broadcast address — packets sent there are delivered to every host on the subnet. That's why a /24 has 256 total addresses but only 254 usable host addresses. Point-to-point /31 links are the exception: RFC 3021 says both addresses MUST be treated as hosts, and there is no directed broadcast, so a /31 has 2 usable addresses and no broadcast. A host route (/32) escapes the rule for a different reason — it has no host bits to reserve — so it counts 1 address and no broadcast.
Picking the right prefix length
The rule of thumb: count hosts, add two for the network and broadcast addresses, then round up to the next power of two. A team of 50 servers needs 52, which rounds to 64: a /26 (64 addresses, 62 usable). The order matters at the edges — 63 hosts need 65 addresses, so a /25, not a /26. Cloud subnets reserve more than two (see the FAQ), so check your provider before sizing tightly. A new VPC on AWS for a startup? A /16, the largest block AWS accepts, gives you 65,536 addresses — overkill, but cheap to provision and lets you sub-divide later. Avoid the temptation to be parsimonious early; the cost of re-IP'ing later is hours of downtime, the cost of provisioning a /16 today is zero.
A /31 has no broadcast, and AWS takes five addresses from every subnet
IPv4 has exactly 4,294,967,296 addresses (2³²). The total internet population has exceeded that for over a decade — NAT and CGNAT are why the system still works.
CIDR was introduced in RFC 1519 in September 1993 and is now defined by RFC 4632 (2006), which notes that CIDR had been thoroughly deployed by 2005. The "Class A/B/C" terminology lingers, but routing no longer uses it.
The largest single private network you can build is 10.0.0.0/8 — 16,777,214 usable hosts. Most enterprise networks use only a fraction.
IANA handed out its last five /8 blocks, one to each regional registry, on 3 February 2011. APNIC, which serves Asia-Pacific, now rations IPv4 from its final /8 (103/8): at most a /23, 512 addresses, per member.
CGNAT space (100.64.0.0/10, RFC 6598) looks public but isn't routable from outside your ISP — if your router's WAN address falls in it, you are behind carrier-grade NAT.
A /31 subnet has only 2 addresses and no network/broadcast convention — RFC 3021 requires both to be treated as host addresses on point-to-point links, so the calculator shows no broadcast for it.
RFC 1122 reserves all of 127.0.0.0/8 — 16,777,216 addresses — for loopback, but systems differ: Linux answers on any of them out of the box, while macOS configures only 127.0.0.1 until you add an alias.
The wildcard mask (the bitwise NOT of the netmask) is used by Cisco ACLs and OSPF. 0.0.0.255 means "match the first three octets, ignore the last."
The IPv4 multicast range is 224.0.0.0/4 — addresses 224 through 239. Streaming protocols, mDNS (.local resolution), and some routing protocols live here.
AWS reserves the first 4 and last 1 address in every VPC subnet (not just network + broadcast). A /28, the smallest subnet AWS allows, gives you 11 usable IPs, not 14.
Frequently asked questions
/24 in CIDR is identical to 255.255.255.0 as a netmask — the CIDR number is the count of leading 1-bits in the binary mask. CIDR is shorter; netmask is what older equipment expects.100.64.0.0/10 identifies CGNAT space. If your home router's WAN IP starts with 100.64–100.127, you're behind CGNAT.10.0.0.0/8 is the largest reserved range — 16,777,214 usable hosts. For public use, it depends on what your registry allocates you under its current policy.0.0.0.255 means "match the first three octets, anything in the last." It's mathematically equivalent to a /24 netmask of 255.255.255.0.Method & sources
How it computes
Strict dotted-decimal parse (four decimal octets 0-255, leading zeros refused), then mask = prefix leading 1-bits; network = IP AND mask, broadcast = network OR NOT mask, usable = 2^(32-p) - 2; /31 has 2 hosts and no broadcast (RFC 3021), /32 one host. Blocks are classed against the IANA special-purpose registry (RFC 6890) as within, overlapping or outside it; split lists the /n pieces.
What this tool implements
- RFC 4632 (CIDR, obsoleting RFC 1519 of September 1993): the prefix length is the count of leading 1-bits in the mask; a mask that is not contiguous 1-bits then 0-bits is refused, and a Cisco-style wildcard (0.0.0.255) entered as a mask is named as one.
- RFC 3021: on a /31 both addresses MUST be treated as hosts and there is no directed broadcast, so the page shows 2 usable and no broadcast. A /32 is a host route (1 address, no broadcast); the page used to label it point-to-point and print a broadcast for both.
- RFC 6943 §3.1.1: inet_pton accepts only four decimal octets, while inet_addr reads a leading zero as octal, so 192.168.010.1 is 192.168.8.1 to the C library. The page now refuses leading zeros rather than guess; it used to read them as decimal, and read "/24abc" as /24.
- Special-purpose classification follows the IANA IPv4 Special-Purpose Address Registry (RFC 6890; RFC 1918, 6598, 5737, 2544 and others) plus multicast 224.0.0.0/4 (RFC 5771), and judges the whole block: 10.0.0.0/7 is reported as containing 10/8 rather than as private, and 192.0.2.0/24 as documentation rather than public.
- Prose checked 2026-10-25: IANA's last five /8s went one to each RIR on 3 February 2011 (NRO), not to APNIC first; APNIC now caps final-/8 delegations at a /23. RDAP shows 203.116.0.0 as STARHUBINTERNET-SG and 118.200.0.0/16 as SINGNET-SG, so netnames end, not start, with the country code. AWS reserves 5 addresses per subnet (/16 to /28), Azure 5, Google Cloud 4 in primary ranges. Linux answers on all of 127/8; macOS only on 127.0.0.1 (measured).
Sources
- Fuller V, Li T. RFC 4632: Classless Inter-domain Routing (CIDR). 2006. https://www.rfc-editor.org/rfc/rfc4632.html
- Retana A, White R, Fuller V, McPherson D. RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links. 2000. https://www.rfc-editor.org/rfc/rfc3021.html
- Thaler D. RFC 6943: Issues in Identifier Comparison for Security Purposes, section 3.1.1. 2013. https://www.rfc-editor.org/rfc/rfc6943.html
- IANA. IPv4 Special-Purpose Address Registry (RFC 6890). https://www.iana.org/assignments/iana-ipv4-special-registry/iana-…
- Rekhter Y et al. RFC 1918: Address Allocation for Private Internets. 1996. https://www.rfc-editor.org/rfc/rfc1918.html
- Weil J et al. RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space. 2012. https://www.rfc-editor.org/rfc/rfc6598.html
- Number Resource Organization. Free Pool of IPv4 Address Space Depleted. 3 February 2011. https://www.nro.net/ipv4-free-pool-depleted/
- APNIC. IPv4 exhaustion (final /8 policy, /23 maximum). https://www.apnic.net/manage-ip/ipv4-exhaustion/
Show 3 more
- Amazon Web Services. Amazon VPC User Guide: Subnet sizing (five reserved addresses). docs.aws.amazon.com
- Google Cloud. VPC subnets: unusable addresses in IPv4 subnet ranges. https://cloud.google.com/vpc/docs/subnets
- Microsoft. Azure Virtual Network FAQ (five reserved addresses per subnet). https://learn.microsoft.com/en-us/azure/virtual-network/virtual-n…
What can make this go out of date
- None at runtime; nothing the reader types leaves the page.
- Cloud reserved-address counts (AWS, Azure, Google Cloud) and the APNIC /23 cap are provider and registry policy and can change.