What this calculator does
A subnet calculator works out the boundaries of an IPv4 network from an address and a prefix length, such as 192.168.1.10/24. It returns the network address, the broadcast address, the range of addresses that can actually be assigned to a device, and how many usable hosts that leaves.
Every calculation here runs on the real 32-bit arithmetic behind IPv4 addressing rather than a shortcut or lookup table: each address is converted to a 32-bit number, masked against the block size implied by the prefix, and the network and broadcast addresses are derived from that. The same maths works identically for a /8 as it does for a /30.
The formula
Each octet of the IP address is combined into a single 32-bit number. The prefix length sets a block size of 2 to the power of (32 minus the prefix): a /24 has a block size of 256, a /30 has a block size of 4. The network address is the largest multiple of that block size at or below the given address, and the broadcast address is one less than the next multiple above it. Usable hosts exclude the network and broadcast addresses, except for /31 links, which have no broadcast address and use both addresses as hosts, and /32, which is a single address with no subnetting at all.
| Term | Meaning |
|---|---|
| CIDR prefix | The number after the slash, giving how many leading bits of the address identify the network, from 0 to 32. |
| Network address | The first address in the block, identifying the subnet itself rather than any host on it. |
| Broadcast address | The last address in the block, used to address every host on the subnet at once. |
| Subnet mask | The prefix length expressed as a dotted address, such as 255.255.255.0 for a /24. |
| Usable hosts | Addresses in the block that can be assigned to an actual device, excluding the network and broadcast addresses. |
The inputs explained
| Field | What to enter |
|---|---|
| IP address | Any IPv4 address in dotted-decimal form, such as 192.168.1.10. It does not need to already be the network address. |
| CIDR prefix length | The CIDR prefix length, from 0 to 32. Common home and office subnets use /24; point-to-point links often use /30 or /31. |
When to use it
Planning how many devices a subnet can hold
Before assigning a block to a site or VLAN, working out its usable host count against the expected number of devices avoids running out of addresses or wasting a much larger block than is needed.
Working out a device’s network and broadcast address
Given any single device’s IP and subnet mask or prefix, this calculator shows the network it belongs to and the range every other device on that same subnet must sit within.
Splitting a larger block into smaller subnets
Running the same base address at increasing prefix lengths shows how a block subdivides, which is the everyday task behind subnetting a larger allocation for multiple departments or sites.
Worked examples
Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.
How a fixed address behaves at different CIDR prefixes
The same base address, at a range of common prefix lengths.
| CIDR prefix | Network address | Broadcast address | Usable hosts |
|---|---|---|---|
| /8 | 192.0.0.0 | 192.255.255.255 | 16,777,214 |
| /16 | 192.168.0.0 | 192.168.255.255 | 65,534 |
| /24 | 192.168.1.0 | 192.168.1.255 | 254 |
| /25 | 192.168.1.0 | 192.168.1.127 | 126 |
| /28 | 192.168.1.0 | 192.168.1.15 | 14 |
| /30 | 192.168.1.0 | 192.168.1.3 | 2 |
Network and broadcast addresses for different starting addresses at /24
A range of addresses, each treated as part of a /24 subnet.
| IP address | Network address | Broadcast address |
|---|---|---|
| 10.0.0.5 | 10.0.0.0 | 10.0.0.255 |
| 172.16.5.20 | 172.16.5.0 | 172.16.5.255 |
| 192.168.1.10 | 192.168.1.0 | 192.168.1.255 |
| 192.168.100.200 | 192.168.100.0 | 192.168.100.255 |
| 8.8.8.8 | 8.8.8.0 | 8.8.8.255 |
| 203.0.113.55 | 203.0.113.0 | 203.0.113.255 |
Questions
What is the difference between a subnet mask and a CIDR prefix?
They express the same thing two different ways. A CIDR prefix like /24 states how many leading bits identify the network; a subnet mask like 255.255.255.0 marks those same bits as 1s in dotted-decimal form. Either one fully determines the other.
Why are the network and broadcast addresses not usable by a host?
The network address identifies the subnet itself, and the broadcast address is reserved to address every host on that subnet simultaneously. Neither can be assigned to an individual device, which is why usable hosts is always 2 less than the total block size, except on /31 and /32 blocks.
What is special about a /31 subnet?
A /31 has a block size of only 2 addresses, too small to spare one for a broadcast address, so networking convention treats both addresses as usable hosts. It is commonly used for point-to-point links between two routers where no broadcast is needed.
How many usable hosts does a /24 have?
A /24 has a block size of 256 addresses, minus 2 for the network and broadcast addresses, leaving 254 usable hosts. That is the most common subnet size for a home or small office network.
For general number base conversions, including binary, used when working with subnet masks by hand, see the number base converter.