Skip to content

Subnet Calculator

A subnet is a contiguous block of IP addresses defined by a prefix length — the number of leading bits that are fixed. This calculator turns any CIDR block or netmask into its network address, broadcast address, usable host range, wildcard mask, and exact host count, entirely in your browser.

Everything is calculated in your browser — this input is never sent to a server.

192.168.1.0/24

IPv4
Network address
192.168.1.0
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Total addresses
256
Usable hosts
254
Network (binary)
11000000.10101000.00000001.00000000
Mask (binary)
11111111.11111111.11111111.00000000
Range type
Private (RFC 1918)

The network address and the broadcast address are not assignable to hosts, so usable hosts is total − 2.

What the prefix length actually means

An IPv4 address is 32 bits. Writing 192.168.1.0/24 says "the first 24 bits identify the network; the remaining 8 bits identify hosts inside it". Those 8 host bits give 2⁸ = 256 addresses, from 192.168.1.0 to 192.168.1.255. Every subnet question reduces to that one piece of arithmetic: host bits = 32 − prefix, and addresses = 2^(host bits).

The netmask is the same information in dotted form. A /24 is 255.255.255.0, which in binary is 24 ones followed by 8 zeros. The wildcard mask is its bitwise inverse (0.0.0.255) and is what Cisco ACLs and some firewall syntaxes expect — getting the two confused is one of the most common causes of a rule that silently matches nothing or everything.

CIDRNetmaskTotal addressesUsable hostsTypical use
/30255.255.255.25242Point-to-point link (classic)
/31255.255.255.25422Point-to-point link (RFC 3021)
/29255.255.255.24886Small block of static IPs from an ISP
/28255.255.255.2401614A rack of servers, a DMZ
/26255.255.255.1926462A department VLAN
/24255.255.255.0256254The default office/VLAN size
/22255.255.252.01,0241,022Four /24s joined
/16255.255.0.065,53665,534A whole site (rarely a single L2 domain)

Why usable hosts is total minus two

In an ordinary IPv4 subnet, two addresses are not assignable to hosts. The network address — all host bits zero — names the subnet itself and appears in routing tables. The broadcast address — all host bits one — reaches every host on the segment at once. Assigning either to an interface breaks things in ways that are hard to diagnose, so 254 is the real capacity of a /24, not 256.

Read the full explanation of subnet calculator results ↓

There are two exceptions the calculator handles correctly. A /31 has no network or broadcast address at all: RFC 3021 defines it specifically for point-to-point links where the two addresses are both usable, and it is now the normal choice for router-to-router links because it wastes nothing. A /32 is a single host route — one address, used for loopbacks, anycast service addresses, and firewall rules that match exactly one machine.

Working out which subnet an address is in

The network address is the address ANDed with the mask. Take 172.16.5.130/26: a /26 has 6 host bits, so subnets step every 64 addresses in the last octet — .0, .64, .128, .192. 130 falls in the .128 block, so the network is 172.16.5.128, the broadcast is 172.16.5.191, and the usable range is 172.16.5.129 to 172.16.5.190.

That "step size" shortcut works for any prefix: the increment is 256 minus the interesting octet of the mask. For /26 the mask octet is 192, so the step is 64. For /28 it is 240, so the step is 16. Once you can do that in your head, most subnetting questions become arithmetic you can check on a whiteboard — and this tool becomes the thing you use to confirm it rather than to work it out.

Private, reserved, and special-purpose ranges

Not every address is routable on the public internet. The calculator labels the block you enter; these are the ones that matter day to day:

  • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — private (RFC 1918). Usable inside your network, never routed on the internet.
  • 100.64.0.0/10 — carrier-grade NAT (RFC 6598). If your "public" address is in here, your ISP is sharing it and you cannot accept inbound connections.
  • 127.0.0.0/8 — loopback. Only ever reaches the local machine.
  • 169.254.0.0/16 — link-local / APIPA. An address here usually means DHCP failed. The single address 169.254.169.254 is also the cloud instance-metadata endpoint, which is why every tool on this site refuses to connect to it.
  • 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 — documentation ranges (RFC 5737). Safe to use in examples and in docs, because they are guaranteed never to be live.
  • 224.0.0.0/4 — multicast. 240.0.0.0/4 — reserved.

IPv6 prefixes: simpler than they look

IPv6 uses the same CIDR notation over 128 bits, and drops the two complications that make IPv4 fiddly: there is no broadcast address, and no address in a prefix is reserved, so every address is usable. The conventions are what you need to remember rather than the arithmetic:

  • /64 is the standard size for any subnet that has hosts on it. SLAAC (stateless address autoconfiguration) assumes 64 host bits; making a host subnet smaller than /64 breaks it.
  • /56 or /48 is what a site is typically assigned. A /56 contains 256 /64s; a /48 contains 65,536 — you subnet by handing out /64s, not by squeezing them.
  • /128 is a single address, the IPv6 equivalent of a /32 host route.
  • fe80::/10 is link-local, fc00::/7 is unique-local (the rough IPv6 analogue of RFC 1918), ff00::/8 is multicast, and 2001:db8::/32 is the documentation range.

The command-line equivalent

ipcalc is the classic tool, and sipcalc handles IPv6 well. Both are packaged on every mainstream distribution:

# Debian/Ubuntu: apt install ipcalc sipcalc
ipcalc 172.16.5.130/26
# Address:   172.16.5.130
# Netmask:   255.255.255.192 = 26
# Network:   172.16.5.128/26
# HostMin:   172.16.5.129
# HostMax:   172.16.5.190
# Broadcast: 172.16.5.191
# Hosts/Net: 62

# IPv6:
sipcalc 2001:db8::/48

# Check whether an address falls inside a prefix, using only iproute2:
ip route get 172.16.5.130
Subnet arithmetic without a browser

Practical planning advice

Size subnets for the broadcast domain, not for the address count. A /16 of hosts on one flat VLAN will drown in ARP and broadcast traffic long before it runs out of addresses; /24 is the conventional ceiling for a single segment for exactly that reason. Leave gaps between allocations so you can grow a subnet by shortening its prefix instead of renumbering. And write down the plan — a documented allocation table is worth more than any calculator when someone else has to extend it two years later.

What's My IP
Your public IPv4/IPv6 and request headers

Frequently asked questions

Why does a /24 have 254 usable hosts and not 256?
The first address in the block is the network address and the last is the broadcast address. Neither can be assigned to a host interface, so a 256-address block holds 254 hosts. The exceptions are /31 (RFC 3021 point-to-point, both addresses usable) and /32 (a single host route).
What is the difference between a netmask and a wildcard mask?
They are bitwise inverses. A netmask marks the network bits with ones (255.255.255.0); a wildcard mask marks the host bits with ones (0.0.0.255). Cisco access lists and some firewall syntaxes take wildcard masks, so entering a netmask where a wildcard is expected produces a rule that matches the wrong set of addresses — often silently.
Can I use a /31 on a normal LAN?
No — only on point-to-point links. RFC 3021 works because there are exactly two devices and no need for a broadcast address. On a multi-access segment you need the network and broadcast addresses, so /30 is the smallest workable block there.
How do I split a /24 into four subnets?
Borrow two host bits, which makes them /26s: x.x.x.0/26, x.x.x.64/26, x.x.x.128/26, and x.x.x.192/26. Each has 64 addresses and 62 usable hosts. To split into eight, borrow three bits for /27s stepping every 32 addresses.
Is this calculator sending my addresses anywhere?
No. All of the arithmetic runs in your browser — there is no API call behind this page, so internal addressing plans you paste in never leave your machine. IPv6 host counts use BigInt arithmetic, so the numbers are exact rather than floating-point approximations.
Why should IPv6 subnets always be /64?
SLAAC derives the host portion of an address from a 64-bit interface identifier, so it stops working on anything longer than a /64. Address scarcity is not a reason to deviate: a single /56 site allocation already contains 256 /64 subnets. Use longer prefixes only for point-to-point links (/127) and host routes (/128).
What does it mean when my public IP is in 100.64.0.0/10?
You are behind carrier-grade NAT. The address is shared among many of your ISP's customers, so inbound connections and port forwarding are impossible and some peer-to-peer applications will struggle. The fixes are a real public IPv4 address from your ISP, or using IPv6.