Unit & number converters

Subnet calculator (CIDR)

Configuring a router, writing a firewall rule or planning a cloud VPC all raise the same questions: what are the network and broadcast addresses, which IPs can hosts use and how many are there, and how is the mask written? Enter an IP and prefix to get all of it at once, and split a network into equal smaller subnets.

Split into subnets

#SubnetUsable hostsBroadcast

Runs entirely in your browser. Nothing you enter here is uploaded.

How to use it

  1. Enter an IP address with a prefix, such as 192.168.1.10/24, or an IP, a space and a subnet mask, such as 172.16.5.4 255.255.255.192. An IP on its own is treated as /32.
  2. Use the /8, /24, /30 and other buttons to change the prefix while keeping the IP.
  3. Read the network the IP belongs to, the network and broadcast addresses, the usable host range and count, the subnet and wildcard masks, and what kind of address it is.
  4. To divide the network, pick a longer prefix under "Split into subnets" to list each subnet's range.

How it is calculated

CIDR prefixes and masks

The CIDR notation defined in RFC 4632 writes a network as address/prefix length: /24 means the first 24 bits identify the network and the remaining 8 number the hosts, which corresponds to the subnet mask 255.255.255.0 — 24 ones followed by 8 zeros. A mask must therefore be contiguous ones followed by zeros; 255.0.255.0 is invalid. The wildcard mask is the mask with every bit inverted, such as 0.0.0.255, which some devices use in access rules. CIDR replaced the old class A, B and C scheme, so the tool does not describe addresses by class.

Network, broadcast and usable hosts

ANDing the IP with the mask gives the network address; setting all host bits to 1 gives the broadcast address. By convention neither is assigned to a host, so a /24 has 256 addresses of which 254 are usable, from .1 to .254. In general a prefix of n has 2 to the power (32 − n) addresses, two fewer usable.

The /31 and /32 special cases

A /30 has four addresses; without the network and broadcast addresses that leaves two, one for each end of a point-to-point link, wasting half. RFC 3021 says that on a point-to-point link with a /31, both addresses must be treated as host addresses, so each link uses only two. The tool therefore shows two usable hosts and no broadcast address for /31. A /32 is a single host, common in routing tables and firewall rules.

Address types

Types come from IANA's IPv4 Special-Purpose Address Registry: private 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (RFC 1918), the carrier-grade NAT shared space 100.64.0.0/10, loopback 127.0.0.0/8, link-local 169.254.0.0/16, documentation 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24, benchmarking 198.18.0.0/15, reserved 240.0.0.0/4 and the limited broadcast 255.255.255.255. Multicast, 224.0.0.0 to 239.255.255.255, follows RFC 5771. Note that 172.16.0.0/12 ends at 172.31.255.255, so 172.32.0.1 is already public.

Examples

InputNetworkBroadcastUsable rangeUsable
192.168.1.10/24192.168.1.0192.168.1.255.1 – .254254
10.20.30.40/1310.16.0.010.23.255.25510.16.0.1 – 10.23.255.254524,286
172.16.5.4 255.255.255.192172.16.5.0172.16.5.63.1 – .6262
192.0.2.7/31192.0.2.6none192.0.2.6 – 192.0.2.72

Splitting 192.168.0.0/24 into /26 gives four subnets — 192.168.0.0/26, 192.168.0.64/26, 192.168.0.128/26 and 192.168.0.192/26 — each with 62 usable addresses; the second runs from 192.168.0.65 to 192.168.0.126. Splitting 10.0.0.0/8 into /24 gives 65,536 subnets, of which the page lists the first 256.

Limits

  • IPv4 only; IPv6 is not supported.
  • Leading zeros (such as 010) are rejected, because some systems read them as octal and the meaning changes.
  • Some cloud providers reserve a few extra addresses in every subnet, so the usable count there can be lower; check their documentation.
  • Splitting is into equal sizes only; variable-length (VLSM) planning is not automated.

Frequently asked questions

How many usable IPs are in a /24?

254. There are 256 addresses, and the network and broadcast addresses are not assigned to hosts.

What prefix is 255.255.255.0?

/24 — the mask has 24 ones.

Why does a /31 have two usable addresses?

RFC 3021 treats both addresses of a /31 on a point-to-point link as host addresses, with no network or broadcast address.

Which IP ranges are private?

10.0.0.0/8, 172.16.0.0/12 (up to 172.31.255.255) and 192.168.0.0/16, per RFC 1918.

Is 100.64.x.x a public address?

No. 100.64.0.0/10 is the shared address space for carrier-grade NAT (RFC 6598).

Sources and further reading

↵ to open · Esc to close