Skip to content

IP Subnet Calculator

Calculate the network, broadcast, mask, host range and host count from an IP and CIDR.

Calculated locally in your browser.

0–32, e.g. 24 for a 255.255.255.0 mask.

How do you calculate a subnet from an IP and CIDR?

The mask has the top CIDR bits set: network = IP AND mask, broadcast = network OR wildcard, and usable hosts = 2^(32 − prefix) − 2 (for prefixes up to /30). For example, 192.168.1.10/24 has network 192.168.1.0, broadcast 192.168.1.255, mask 255.255.255.0 and 254 usable hosts.

Understanding your result

A /31 has 2 addresses (point-to-point links) and a /32 is a single host, so the usual “minus 2” rule doesn’t apply to them.

Formula and method

The mask has the top CIDR bits set. Network = IP AND mask; broadcast = network OR wildcard; usable hosts = 2^(32 − prefix) − 2 (for prefixes up to /30).

Assumptions and limitations

This calculator works with IPv4 addresses and CIDR prefixes only; it does not cover IPv6. It computes a single subnet's boundaries and does not plan variable-length subnetting across a whole network, allocate ranges, or check for overlaps between multiple subnets you might be designing together.

Worked example

192.168.1.10/24 has network 192.168.1.0, broadcast 192.168.1.255, mask 255.255.255.0 and 254 usable hosts.

How to use this tool

  1. Enter an IPv4 address such as 192.168.1.10.
  2. Enter the CIDR prefix length (0–32).
  3. Press Calculate.

About the IP Subnet Calculator

The IP Subnet Calculator breaks down an IPv4 address and CIDR prefix into its network and broadcast addresses, subnet mask, wildcard mask, usable host range and total hosts.

Who should use this tool

Network engineers planning address allocations, sysadmins configuring routers and firewalls, and students studying for networking certifications. Anyone who has an IPv4 address with a CIDR prefix and needs the network, broadcast, mask, usable host range, and host count worked out reliably will find this saves manual bit arithmetic.

Benefits

  • Derives network, broadcast, mask and wildcard together
  • Shows the usable host range and total host count
  • Correctly handles the /31 and /32 special cases
  • Calculates everything locally in your browser

Practical use cases

  • Planning an address block for a new office VLAN
  • Finding the broadcast address for a firewall rule
  • Checking how many hosts a /26 subnet allows
  • Studying subnetting for a networking exam

Explore all Developer Tools tools

Frequently asked questions

What does the CIDR number mean?

It’s how many leading bits are the network portion. /24 means the first 24 bits are the network, leaving 8 bits (256 addresses) for hosts.

Why does a /31 subnet not subtract two addresses?

Normally the network and broadcast addresses are reserved, leaving usable hosts as two to the power of the host bits minus two. A /31 has only two addresses and is defined for point-to-point links where both are usable, and a /32 is a single host, so the minus-two rule does not apply.

How do I work out the number of usable hosts from a CIDR prefix?

Subtract the prefix from 32 to get the host bits, raise two to that power for total addresses, then subtract two for the network and broadcast addresses. For example, a /24 has 8 host bits, giving 256 addresses and 254 usable hosts. This applies to prefixes up to /30.

Share this tool

Free to use — copy the link, share it anywhere, or add the tool to your own website.

Embed this tool on your site (free)

Copy this code and paste it into any web page — it stays free and always up to date: