Home / Other Calculators / Subnet Calculator

Utilities

Subnet Calculator

Enter an IPv4 address and CIDR prefix to get the network and broadcast addresses, subnet mask, wildcard mask, usable host range, and host count.

Network address

192.168.1.0

Broadcast—
Subnet mask—
Host range—
Usable hosts—

How it works

An IPv4 address is 32 bits. The CIDR prefix says how many leading bits are the network portion; the rest address hosts. Applying the mask with a bitwise AND gives the network address, and setting all host bits gives the broadcast address.

mask = 0xFFFFFFFF shifted left by (32 − prefix)
network = IP AND mask
broadcast = network OR (NOT mask)
usable hosts = 2^(32 − prefix) − 2

Common prefixes

CIDRMaskUsable hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/30255.255.255.2522

Subnet cheat sheet and worked example

PrefixSubnet maskAddressesUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242

Example: 192.168.1.130/26 has a block size of 64, so its network is 192.168.1.128, its broadcast address is 192.168.1.191, and usable hosts run from .129 to .190 (62 addresses). A /31 has no network or broadcast address and is used for point-to-point links (RFC 3021), and a /32 is a single host.

Private networks use the RFC 1918 ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

Choosing a subnet size

Hosts neededPrefixSubnet maskUsable hosts
2/30255.255.255.2522
up to 14/28255.255.255.24014
up to 62/26255.255.255.19262
up to 254/24255.255.255.0254
up to 510/23255.255.254.0510
up to 1,022/22255.255.252.01,022
up to 4,094/20255.255.240.04,094
up to 65,534/16255.255.0.065,534

Leave room for growth: pick the next size up if you're close to the limit.

Wildcard masks

A wildcard mask is the inverse of the subnet mask, used in Cisco ACLs and OSPF. Subtract each octet of the mask from 255: /24 (255.255.255.0) becomes 0.0.0.255, and /26 (255.255.255.192) becomes 0.0.0.63.

Subnetting example: splitting a /24

SubnetNetworkUsable rangeBroadcast
1192.168.10.0/26.1 – .62.63
2192.168.10.64/26.65 – .126.127
3192.168.10.128/26.129 – .190.191
4192.168.10.192/26.193 – .254.255

What about IPv6?

IPv6 addresses are 128 bits. A standard LAN subnet is a /64, which holds 2⁶⁴ addresses, so host counts are never a constraint. Sites typically receive a /48 or /56 and divide it into /64 subnets.

Frequently asked questions

What is CIDR notation?

An IP followed by a slash and prefix length, like 192.168.1.0/24, the prefix is the number of network bits.

Why are two addresses unusable?

The first is the network ID and the last is the broadcast address, so a /24 has 254 usable hosts, not 256.

How many hosts are in a /24?

254 usable hosts out of 256 addresses, after the network and broadcast addresses.

What subnet mask is /26?

255.255.255.192, which gives 64 addresses and 62 usable hosts.

How do I calculate a wildcard mask?

Subtract each octet of the subnet mask from 255. A /27 mask of 255.255.255.224 has a wildcard mask of 0.0.0.31.

How many /26 subnets fit in a /24?

Four. Each /26 has 64 addresses (62 usable), and 4 × 64 = 256.

Related calculators