IP Subnet Calculator (IPv4 CIDR)

A subnet is a block of IP addresses defined by a prefix length. A /24 has 2^(32−24) = 256 addresses and 254 usable hosts. For 192.168.1.10/24 the network is 192.168.1.0, the broadcast 192.168.1.255 and the mask 255.255.255.0. Usable hosts = 2^(32−prefix) − 2.

Inputs

For example 192.168.1.10
Result
–

Results are calculated in your browser for convenience. Double-check important figures before relying on them.

How do you calculate a subnet?

Subnet mask = prefix ones followed by zeros (24 → 255.255.255.0) Network address = IP AND mask Broadcast address = network OR (NOT mask) Total addresses = 2^(32 − prefix); usable hosts = total − 2

Example: 192.168.1.10/24. The mask is 255.255.255.0, so the network is 192.168.1.0 and the broadcast is 192.168.1.255. There are 256 addresses and 254 usable hosts (192.168.1.1 to 192.168.1.254).

Another: 10.0.5.77/20. The mask is 255.255.240.0, the network is 10.0.0.0, the broadcast 10.0.15.255 and there are 4,094 usable hosts.

Common prefix lengths

PrefixMaskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/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

Private addresses and special cases

Three ranges are reserved for private networks and are not routed on the internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. A /31 is used for point-to-point links (2 addresses, no broadcast) and a /32 identifies a single host. Splitting a network into smaller subnets means increasing the prefix: a /24 splits into two /25 networks, four /26 networks and so on. Use the tool to check your plan, and see the guide to subnetting. Results are IPv4 only.

Tips for planning a network

Plan the number of hosts you need now and in the next few years, and leave room to grow. Keep a record of every subnet you assign so that ranges never overlap, and keep the first or last usable address for the gateway by habit. Use private ranges inside your network, and separate guest devices from important systems by giving them their own subnet.

Complete guide to the IP Subnet Calculator

How to use the IP Subnet Calculator, step by step

  1. Enter the IPv4 address.
  2. Choose the prefix length.
  3. Read the network, mask and host range.
  4. Check the host count against your needs.

Common mistakes to avoid

  • Using the network or broadcast address for a device.
  • Mixing up the subnet and wildcard masks.
  • Forgetting that /31 and /32 are special.

Key terms explained

CIDR
Address plus prefix length, like /24.
Subnet mask
Shows which bits are the network.
Broadcast address
The last address of a subnet.
Wildcard mask
The inverse of the subnet mask.

Frequently asked questions

How many hosts are in a /24?

254 usable hosts (256 addresses minus the network and broadcast addresses).

What is CIDR?

Classless Inter-Domain Routing, a way to write a network as an address and a prefix length, such as 192.168.1.0/24.

What is a wildcard mask?

The inverse of the subnet mask, used in some router access lists. For /24 it is 0.0.0.255.

What is the subnet mask for /26?

The mask for /26 is 255.255.255.192. That gives 64 addresses in total and 62 usable host addresses.

What are private IP ranges?

The three private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not routed on the public internet.

Related calculators

Guides worth reading