IP Subnet Calculator

Calculate network, broadcast, usable host range and subnet mask from any IPv4 CIDR. Everything is computed in your browser.

Updated:

100% client-side

Subnet input

Network bits Host bits

Results

Network address
—
Broadcast address
—
Usable host range
—
Usable hosts
—
Total addresses
—
Subnet mask
—
Wildcard mask
—
CIDR notation
—

What is IP subnetting?

Every device on a network has an IPv4 address, and subnetting is how that address space is split into smaller networks. A CIDR notation like 192.168.1.10/24 pairs an address with a prefix that says how many of its bits are "network" bits (shared by every device in the subnet) versus "host" bits (unique to each device). Subnetting lets you carve one large address block into smaller, separately-routable networks — the same math behind home router "IP ranges" and cloud VPC subnets.

How to use IP Subnet Calculator

  1. Enter an address in IP address (or click Example for a sample).
  2. Enter a prefix, mask, or plain number in Prefix or mask — e.g. /24, 24, or 255.255.255.0.
  3. Read the network address, broadcast address, usable host range and subnet mask under Results.
  4. Click Copy to copy the full result.

How the subnet math works

An IPv4 address is a 32-bit number, usually written as four decimal octets. A CIDR prefix (/24) says how many of those 32 bits are fixed as the "network" portion; the remaining bits identify individual hosts inside that network. The network address zeroes out every host bit, and the broadcast address sets every host bit to 1:

For a /8 to /32 cheat sheet, a subnet worked out by hand and the addresses AWS and Azure reserve, read the guide CIDR Notation and Subnetting, with a Cheat Sheet.

192.168.1.10/24
→ Mask:       255.255.255.0   (24 network bits, 8 host bits)
→ Network:    192.168.1.0
→ Broadcast:  192.168.1.255
→ Usable:     192.168.1.1 – 192.168.1.254  (254 hosts)

The usable host count follows RFC 4632's formula 2^(32 - prefix) - 2, subtracting the network and broadcast addresses from the total block size. Two prefixes are special cases per RFC 3021: a /31 has exactly 2 usable addresses (no broadcast — both addresses in the block are valid hosts, meant for point-to-point links), and a /32 identifies exactly 1 host with no network or broadcast concept at all. This tool builds the address as a real 32-bit integer and runs the mask math with bitwise operators — no string-based octet arithmetic, which is where off-by-one errors on the /31 and /32 edge cases usually creep in.

Examples

Both results were cross-checked with Python's ipaddress module (ip_interface('10.20.30.77/26').network), which gave the same network, broadcast and masks.

1. Which subnet does a host belong to? A server reports 10.20.30.77/26 and you need the range for a DHCP scope or a firewall rule. A /26 splits the last octet into blocks of 64, so .77 falls in the .64 block:

IP 10.20.30.77   Prefix /26

Network address     10.20.30.64
Broadcast address   10.20.30.127
Usable host range   10.20.30.65 – 10.20.30.126
Usable hosts        62
Subnet mask         255.255.255.192 (/26)
Wildcard mask       0.0.0.63
CIDR notation       10.20.30.64/26

2. A point-to-point link given as a dotted mask. Router configs and ISP hand-offs often show 255.255.255.252 instead of a prefix. Type the mask as it is and the tool converts it: two usable addresses, one for each end of the link. Cisco ACLs expect the wildcard mask:

IP 203.0.113.9   Prefix 255.255.255.252

Network address     203.0.113.8
Broadcast address   203.0.113.11
Usable host range   203.0.113.9 – 203.0.113.10
Usable hosts        2
Wildcard mask       0.0.0.3
CIDR notation       203.0.113.8/30

Working with IPv6 instead? The IPv6 subnet calculator does the same for prefixes like /48 and /64. Ranges like these also appear as ip4: mechanisms in SPF records, which the DNS record validator breaks down.

Reference: RFC 4632 (Classless Inter-Domain Routing).

Frequently asked questions

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing, RFC 4632) writes a subnet as an IP address followed by a slash and a prefix length, e.g. 192.168.1.0/24. The prefix length is how many leading bits of the 32-bit address are the network portion; the rest are host bits.

Why does a /31 subnet have no broadcast address?

RFC 3021 defines /31 as a special case for point-to-point links: both addresses in the 2-address block are usable as host addresses, since a link with only two devices doesn't need a separate broadcast address. A /32 similarly has no network or broadcast portion at all — it identifies exactly one host.

How is the number of usable hosts calculated?

For a /0 through /30 prefix, usable hosts = 2^(32-prefix) - 2, subtracting the network and broadcast addresses. /31 has exactly 2 usable addresses and /32 has exactly 1, as special cases.

Can I enter a dotted subnet mask instead of a CIDR prefix?

Yes. The prefix field accepts /24, 24, or 255.255.255.0 — all three are parsed and normalized to the same result.