StatGardenREF. DESK
Calculators/Everyday/Subnet
Everyday

Subnet calculator

Network address, broadcast address and usable host range for an IPv4 address and CIDR prefix.

Published 21 August 2026

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

FormulaNetwork = largest multiple of the block size at or below the address; Broadcast = Network + block size − 1; block size = 2^(32 − prefix)

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.

TermMeaning
CIDR prefixThe number after the slash, giving how many leading bits of the address identify the network, from 0 to 32.
Network addressThe first address in the block, identifying the subnet itself rather than any host on it.
Broadcast addressThe last address in the block, used to address every host on the subnet at once.
Subnet maskThe prefix length expressed as a dotted address, such as 255.255.255.0 for a /24.
Usable hostsAddresses in the block that can be assigned to an actual device, excluding the network and broadcast addresses.

The inputs explained

FieldWhat to enter
IP addressAny IPv4 address in dotted-decimal form, such as 192.168.1.10. It does not need to already be the network address.
CIDR prefix lengthThe 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.

192.168.1.0, varying prefix
CIDR prefixNetwork addressBroadcast addressUsable hosts
/8192.0.0.0192.255.255.25516,777,214
/16192.168.0.0192.168.255.25565,534
/24192.168.1.0192.168.1.255254
/25192.168.1.0192.168.1.127126
/28192.168.1.0192.168.1.1514
/30192.168.1.0192.168.1.32
A /8 covers over 16 million addresses from a single starting octet, while a /30 narrows the same starting address down to just 2 usable hosts, the size needed for a simple point-to-point link.

Network and broadcast addresses for different starting addresses at /24

A range of addresses, each treated as part of a /24 subnet.

Fixed /24 prefix
IP addressNetwork addressBroadcast address
10.0.0.510.0.0.010.0.0.255
172.16.5.20172.16.5.0172.16.5.255
192.168.1.10192.168.1.0192.168.1.255
192.168.100.200192.168.100.0192.168.100.255
8.8.8.88.8.8.08.8.8.255
203.0.113.55203.0.113.0203.0.113.255
At a /24 prefix the network and broadcast addresses always share the first three octets with the original address, differing only in the last octet, since a /24 leaves exactly one octet of host bits free.

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.