Subnet Calculator (IPv4 CIDR)

· How we calculate · Free, no sign-up

Quick answer

The network address is the IP AND the subnet mask, the broadcast address is the network OR the wildcard mask, and usable hosts = 2(32 − prefix) − 2. Example: 192.168.1.10/24 → network 192.168.1.0, broadcast 192.168.1.255, usable hosts 192.168.1.1–192.168.1.254 (254 hosts).

Type an IPv4 address with a CIDR prefix (or a dotted subnet mask) to see the network and broadcast addresses, the usable host range, wildcard mask, binary breakdown and address type — then split the block into smaller subnets.

How to use the subnet calculator

  1. Type an IPv4 address. You can paste CIDR notation such as 10.0.5.77/22 and the prefix is picked up automatically.
  2. Choose a CIDR prefix or type a subnet mask. The two stay in sync, so typing 255.255.252.0 selects /22.
  3. Read the network, broadcast, first and last usable host, host count, wildcard mask, class and address type. The binary view highlights the network bits.
  4. Optionally pick a longer prefix under Split into subnets to list every smaller network inside the block. This is handy for VLAN or VPC planning.

CIDR notation explained

An IPv4 address is 32 bits, written as four 8-bit octets. Classless Inter-Domain Routing (CIDR) adds a slash and a prefix length, such as /24. That number says how many leading bits belong to the network. The remaining 32 − prefix bits number the hosts inside it. The subnet mask is the same idea written as an address, with the prefix bits set to 1 and the host bits set to 0.

Network = IP AND mask Broadcast = Network OR wildcard (wildcard = NOT mask) Addresses = 2^(32 − prefix) Usable = 2^(32 − prefix) − 2 (/31 → 2, /32 → 1)

Worked example: 10.0.5.77/22

A /22 mask is 22 ones: 11111111.11111111.11111100.00000000 = 255.255.252.0, so the wildcard is 0.0.3.255. The third octet 5 is 00000101. Keeping its top six bits gives 00000100 = 4, so the network is 10.0.4.0. Setting the ten host bits to 1 gives the broadcast 10.0.7.255. The usable range is 10.0.4.1 – 10.0.7.254, which is 210 − 2 = 1,022 hosts. 10.0.0.0/8 is RFC 1918 space, so the address is private.

Splitting a network

Each bit you add to the prefix doubles the number of subnets and halves their size. A /24 split into /26 networks gives 4 subnets of 64 addresses: 192.168.1.0, .64, .128 and .192. Each has 62 usable hosts. To size a subnet, find the smallest power of two that is at least hosts + 2. For 50 hosts that is 64 addresses, which means a /26.

Subnet cheat sheet (/8 to /32)

CIDRSubnet maskWildcardAddressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (RFC 3021)
/32255.255.255.2550.0.0.011

Special IPv4 ranges

BlockPurpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918). Not routed on the public internet
100.64.0.0/10Carrier-grade NAT shared address space (RFC 6598)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local / APIPA, used when DHCP fails
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation and examples (RFC 5737)
224.0.0.0/4Multicast (old Class D)
240.0.0.0/4Reserved (old Class E), including 255.255.255.255 broadcast

Tips

Sources

Embed this calculator on your website — free

Copy this code into your page. The calculator stays up to date automatically and resizes to fit.

Frequently asked questions

How many usable hosts are in a /24 subnet?

A /24 has 28 = 256 addresses. The first (network) and last (broadcast) are reserved, leaving 254 usable hosts. In general usable hosts = 2(32 − prefix) − 2 for prefixes /0 to /30.

Why does a /31 show 2 usable hosts?

RFC 3021 allows /31 networks on point-to-point links, where there is no need for network or broadcast addresses, so both addresses are usable. A /32 identifies a single host (often a loopback or a host route), so it has exactly 1 address.

What is a wildcard mask?

A wildcard mask is the bitwise inverse of the subnet mask: 255.255.255.0 becomes 0.0.0.255. Cisco ACLs and OSPF network statements use it, where 0 bits must match and 1 bits are “don’t care”.

How do I convert a subnet mask to CIDR notation?

Count the 1 bits in the mask. 255.255.255.0 is 24 ones (/24), 255.255.252.0 is 8 + 8 + 6 = 22 ones (/22) and 255.255.255.192 is 26 ones (/26). The ones must be contiguous — 255.0.255.0 is not a valid mask.

Which IP addresses are private?

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. Also not publicly routable: 100.64.0.0/10 (carrier-grade NAT), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local) and the documentation ranges 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24.

How many /26 subnets fit in a /24?

Borrowing 2 bits gives 2(26 − 24) = 4 subnets of 64 addresses each (62 usable hosts): .0, .64, .128 and .192. Use the “Split into subnets” option to list them.