Subnet Calculator (IPv4 CIDR)
Find network, broadcast, mask and usable hosts from a CIDR.
What this subnet calculator does
Enter an IPv4 address with a CIDR prefix, such as 192.168.1.10/24, and this calculator shows the network address, broadcast address, subnet mask, first and last usable host, and the number of usable hosts. It runs entirely in your browser, so nothing you type is sent anywhere.
It is made for network engineers, sysadmins, cloud and DevOps engineers, students preparing for networking exams, and anyone who needs to plan an IP range, write a firewall rule or check that two addresses are in the same subnet.
How to use the subnet calculator
- Type an address and prefix into the IP/CIDR field, for example 10.0.5.77/27. The address can be any address inside the subnet; it does not need to be the network address.
- Click Calculate.
- Read the table: Network, Broadcast, Mask, First host, Last host and Usable hosts.
- Change the prefix (for example from /24 to /26) and calculate again to compare sizes.
The tool accepts IPv4 only. Each of the four octets must be 0–255 and the prefix must be 0–32.
Understanding CIDR notation
CIDR (Classless Inter-Domain Routing) writes a network as an address plus a prefix length. The prefix says how many of the 32 bits in an IPv4 address belong to the network part. The remaining bits are the host part. A /24 leaves 8 host bits, so the block has 2^8 = 256 addresses. The subnet mask is the same information written as an address: /24 is 255.255.255.0, /27 is 255.255.255.224.
How to read the results
- Network – the first address of the block, with all host bits set to 0. It identifies the subnet and is not assigned to a device in an ordinary subnet.
- Broadcast – the last address of the block, with all host bits set to 1. Packets sent here reach every host on the subnet.
- Mask – the subnet mask in dotted-decimal form.
- First host and Last host – the range you can assign to devices.
- Usable hosts – the number of assignable addresses: 2^(32 − prefix) − 2 for ordinary subnets.
Worked examples
- 192.168.1.10/24 → network 192.168.1.0, broadcast 192.168.1.255, mask 255.255.255.0, hosts 192.168.1.1 to 192.168.1.254, 254 usable hosts.
- 10.0.5.77/27 → network 10.0.5.64, broadcast 10.0.5.95, mask 255.255.255.224, hosts 10.0.5.65 to 10.0.5.94, 30 usable hosts.
- 172.16.40.1/20 → network 172.16.32.0, broadcast 172.16.47.255, mask 255.255.240.0, 4,094 usable hosts.
The /31 and /32 special cases
A /31 has only two addresses. RFC 3021 allows both to be used as host addresses on point-to-point links, so the calculator shows 2 usable hosts. A /32 is a single address (a host route), often used for loopbacks and firewall rules that target one machine, so it shows 1.
Common use cases
- Planning address ranges for an office LAN, VLANs or a home lab.
- Sizing cloud VPC subnets before you create them.
- Writing firewall, security group or access-list rules with the right CIDR.
- Checking whether two IP addresses fall in the same subnet: if they give the same network address with the same prefix, they do.
- Practising subnetting for networking exams and checking manual calculations.
Quick reference
- /30 – mask 255.255.255.252 – 4 addresses, 2 usable
- /29 – mask 255.255.255.248 – 8 addresses, 6 usable
- /28 – mask 255.255.255.240 – 16 addresses, 14 usable
- /27 – mask 255.255.255.224 – 32 addresses, 30 usable
- /26 – mask 255.255.255.192 – 64 addresses, 62 usable
- /25 – mask 255.255.255.128 – 128 addresses, 126 usable
- /24 – mask 255.255.255.0 – 256 addresses, 254 usable
- /16 – mask 255.255.0.0 – 65,536 addresses, 65,534 usable
Tips and common mistakes
- Cloud providers reserve extra addresses. Major cloud platforms reserve some addresses in every subnet for their own services, so the real number of usable addresses there is lower than the standard figure. Check your provider's documentation.
- Don't assign the network or broadcast address to a device in an ordinary subnet. It causes confusing connectivity problems.
- Use private ranges for internal networks. RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private use.
- Leave room to grow. Choosing a slightly larger subnet now is easier than renumbering later.
- Watch overlapping ranges when you connect networks with a VPN or peering. Overlaps break routing.
Frequently asked questions
How many usable hosts are in a /24?
254. A /24 has 256 addresses; the network and broadcast addresses are reserved.
What is the difference between a subnet mask and a CIDR prefix?
They describe the same thing. The prefix counts the network bits (/24), while the mask writes those bits as an address (255.255.255.0).
Why are two addresses subtracted from the host count?
In an ordinary subnet, the all-zeros host address identifies the network and the all-ones host address is the broadcast address. Neither can be assigned to a device.
Can I use a /31?
Yes, on point-to-point links between two devices that support it. RFC 3021 defines this use. Do not use /31 for a normal LAN.
Does it support IPv6?
No, this calculator works with IPv4 only. IPv6 has no broadcast address and uses much larger prefixes.
Do I need to enter the network address?
No. Enter any address in the block plus the prefix and the tool works out the network for you.
Related tools
- Ping IP – test whether an address in your range responds.
- SSL Check – check the HTTPS certificate of a server you just set up.
- Cron Expression Explainer – check the schedule of maintenance jobs.
- Unix Timestamp Converter – read timestamps in router and server logs.