IPv4 Subnet Calculator

Share:
Developer Tools

IPv4 Subnet Calculator

Calculate network, broadcast, host range, and subnets from CIDR or netmask.

By Checked against sources by Last reviewed CIDR NETWORKING SUBNET
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

IPv4 Subnet Calculator Tool

Advertisement
After results · AD-W1 Responsive · Post-tool — peak engagement

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.

Advertisement
After how-to · AD-W2 Responsive

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

01

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.

02

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.

03

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.

04

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.

05

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.

06

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.

07

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.

08

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."

09

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.

10

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

They express the same information. /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.
By convention, the all-zeros host portion is the network identifier and the all-ones portion is the broadcast address (sent to every host on the subnet). RFC 3021 allows /31 point-to-point links to skip this convention, but for typical subnets the rule holds.
Carrier-Grade NAT lets ISPs share one public IPv4 address across many subscribers. The reserved range 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.
Because the leading zero is ambiguous. The strict dotted-decimal form (what inet_pton accepts) is four decimal numbers from 0 to 255, but the older inet_addr and inet_aton functions read a leading zero as octal, so 010 means 8, not 10 (RFC 6943, section 3.1.1). Rather than guess which you meant, the calculator asks you to drop the zero.
Yes — they are private networks, so they don't collide on the public internet. The conflict appears only when you VPN between them, because the routing table can't decide which 192.168.1.0/24 you mean. For interop, pick distinct private ranges (10.x for one site, 192.168.x for the other).
For private use, 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.
AWS reserves five addresses per subnet, not just two — the network address, the VPC router (.1), DNS (.2), a future-use (.3), and the broadcast. A /28 has 16 total, 5 reserved, 11 usable. Azure also reserves five (network, gateway, two for DNS, broadcast); Google Cloud reserves four in a subnet's primary range (network, gateway, second-to-last, broadcast) and none in secondary ranges.
The bitwise inverse of the netmask. Cisco IOS ACLs and OSPF use wildcard masks: 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.
Add one bit to the prefix and you get two subnets of half the size. A /24 split into /25 produces 192.168.1.0/25 (hosts .1–.126) and 192.168.1.128/25 (hosts .129–.254). Split into /26 produces four. Enter the larger block above and use Split into to list every piece with its host range.
IPv6 uses a completely different addressing model with 128-bit addresses and no broadcast concept. The math is similar but the address space is 7.9 × 10²⁸ times larger (2⁹⁶). Use the IPv6 subnet calculator for those.
No. All computation happens in your browser via vanilla JavaScript. The IP or CIDR you enter never leaves the page. You can confirm via your browser's network tab.

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

Show 3 more

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.
Advertisement
Pre-footer · AD-W3 728 × 90