IP Subnet Calculator

Calculate subnet mask, network address, broadcast address, and host range for any IP/CIDR.

/

Common Subnets

About this calculator

Enter an IPv4 address and a prefix length (CIDR) and get the subnet mask, network address, broadcast address, first and last usable host and total hosts. Quick buttons set common prefixes.

The calculation is done in your browser.

How to use it

  1. Enter the IP address and prefix length (for example 24).
  2. Press Calculate.
  3. Read the mask, network, broadcast and host range.

Subnet maths

An IPv4 address is 32 bits. The prefix /n means the first n bits are the network. Hosts per subnet = 2(32−n) − 2 (minus the network and broadcast addresses). The mask has n ones followed by zeros: /24 is 255.255.255.0, /16 is 255.255.0.0, /26 is 255.255.255.192. Network = address AND mask; broadcast = network OR the inverted mask.

Worked example

192.168.1.0/24

Mask255.255.255.0
Network192.168.1.0
Broadcast192.168.1.255
Usable hosts192.168.1.1 to 192.168.1.254 (254 hosts)
/2664 addresses, 62 hosts
/304 addresses, 2 hosts (point-to-point links)

Tips and common mistakes

  • Plan for growth: pick a subnet about double the current need.
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
  • /31 is allowed for point-to-point links (RFC 3021).
  • Keep a table of what each subnet is for.
  • Use VLSM to avoid wasting addresses.

Frequently asked questions

How many hosts are in a /24?

254 usable.

What is the subnet mask for /26?

255.255.255.192.

What is CIDR?

Notation that writes the network size as /n.

What are private IP ranges?

10/8, 172.16/12 and 192.168/16.

What is the broadcast address?

The last address in the subnet.

Is it free?

Yes.

Related tools