Example 1
- 192.168.1.42
- CIDR 24
254
How many hosts are in 192.168.1.42/24? There are 254 usable addresses, because 256 − 2 = 254. The network address is 192.168.1.0 and the mask is 255.255.255.0.
Enter an IPv4 address and a CIDR prefix, and the calculator returns the subnet mask, network address, broadcast address, host range and address count. 192.168.1.42/24 gives 254 usable hosts, 10.0.0.1/16 gives 65,534, and 172.16.0.1/30 gives 2. The calculator performs address math only and does not check a live network.
Enter an IPv4 address and CIDR prefix, then click Calculate.
The calculator performs IPv4 address math. It does not check a live network and does not run traceroute. For a DHCP pool, use the DHCP range calculator. For the method behind the masks, read how to calculate a subnet mask.
The IP subnet calculator takes an IPv4 address and a CIDR prefix and works out the canonical network address, subnet mask, wildcard mask, broadcast address, first and last usable host, and the number of addresses in the block. You can enter any host address inside the subnet or use the address/prefix form, so you do not need to know the network address in advance. The result also shows whether the block belongs to a private IPv4 range.
CIDR notation (Classless Inter-Domain Routing, RFC 4632), such as /24, states how many leading bits of the address belong to the network part. The remaining bits describe hosts. A /24 prefix corresponds to the mask 255.255.255.0 and a block of 256 addresses. The larger the prefix number, the smaller the subnet: each extra prefix bit halves the number of addresses.
The calculator applies the standard IPv4 subnet arithmetic from RFC 4632. For a prefix p and an address A, it computes:
Example for 192.168.1.130/26: a /26 prefix leaves 6 host bits, so the block has 26 = 64 addresses and 62 usable hosts. The mask is 255.255.255.192, because the last octet is 11000000, which is 192. The last octet of the address, 130 (10000010), AND 192 gives 128, so the network address is 192.168.1.128. The broadcast address is 128 + 63 = 191, which is 192.168.1.191, and the hosts run from 192.168.1.129 to 192.168.1.190. The wildcard mask is 0.0.0.63.
The table lists common IPv4 subnet sizes with their mask, total addresses and usable hosts.
| Prefix | Subnet mask | Total | Usable | Typical use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | very large networks, private range 10.0.0.0/8 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 | private range 172.16.0.0/12 |
| /16 | 255.255.0.0 | 65,536 | 65,534 | large VPC networks, campuses |
| /20 | 255.255.240.0 | 4,096 | 4,094 | medium VPC and VLAN networks |
| /23 | 255.255.254.0 | 512 | 510 | larger office networks |
| /24 | 255.255.255.0 | 256 | 254 | typical LAN or VLAN |
| /25 | 255.255.255.128 | 128 | 126 | half of a /24 network |
| /26 | 255.255.255.192 | 64 | 62 | small VLANs and segments |
| /27 | 255.255.255.224 | 32 | 30 | small host groups |
| /28 | 255.255.255.240 | 16 | 14 | small pools, labs |
| /29 | 255.255.255.248 | 8 | 6 | small links, DMZ segments |
| /30 | 255.255.255.252 | 4 | 2 | point-to-point links |
| /31 | 255.255.255.254 | 2 | 2* | point-to-point links (RFC 3021) |
| /32 | 255.255.255.255 | 1 | 1* | a single host or a host route |
* A /31 and a /32 have different semantics than a classic LAN, so the "minus 2" rule does not apply to them. See the FAQ below.
10.0.0.0/8 — 10.0.0.0 to 10.255.255.255172.16.0.0/12 — 172.16.0.0 to 172.31.255.255192.168.0.0/16 — 192.168.0.0 to 192.168.255.255These ranges are meant for local networks, offices and internal cloud networks, and they are not routed on the public Internet. The calculator marks a result as private when the network falls inside one of these ranges.
The IP subnet calculator works out the parameters of one IPv4 block from an address and a CIDR prefix. 192.168.1.42/24 gives 254 usable hosts, 10.0.0.1/16 gives 65,534, 172.16.0.1/30 gives 2, and 192.168.1.130/26 gives 62.
The total number of addresses is 2 to the power of (32 minus the prefix). Usable hosts are that number minus the network address and the broadcast address, so 256 − 2 is 254 and 65,536 − 2 is 65,534. The network address comes from a bitwise AND of the address and the mask, and the broadcast address comes from setting the host bits to 1.
The result depends only on the numbers you enter. The calculator does not query a router or a network interface, so it does not show which addresses are actually in use. The /31 and /32 prefixes are handled separately, because they have no network and broadcast address in the classic sense.
To check the example, enter 192.168.1.42 and the prefix 24, then click Calculate. An empty address or a prefix outside 0–32 is reported as a field error.
These terms appear in the calculator results. Example: 192.168.1.42/24 gives 254 usable hosts.
254
How many hosts are in 192.168.1.42/24? There are 254 usable addresses, because 256 − 2 = 254. The network address is 192.168.1.0 and the mask is 255.255.255.0.
65,534
How many hosts are in 10.0.0.1/16? There are 65,534 usable addresses, because 65,536 − 2 = 65,534. The mask is 255.255.0.0.
2
How many hosts are in 172.16.0.1/30? There are 2 usable addresses, which is exactly what a point-to-point link needs. The mask is 255.255.255.252.
62
What is the subnet mask for 192.168.1.130/26? The mask is 255.255.255.192, the network address is 192.168.1.128, the broadcast address is 192.168.1.191, and there are 62 usable hosts.
The CIDR prefix says how many leading bits of the address belong to the network part. The calculator turns it into a subnet mask, applies a bitwise AND of the address and the mask to get the network address, and then sets the host bits to 1 to get the broadcast address. For 192.168.1.42/24, the network address is 192.168.1.0 and the broadcast address is 192.168.1.255.
The total number of addresses is 2^(32 − prefix). Usable hosts are that number minus 2, for the network address and the broadcast address. A /24 has 254 usable hosts, a /16 has 65,534, a /20 has 4,094, and a /30 has 2.
The mask has as many leading ones as the prefix length, and the remaining bits are zeros. A /24 is 24 ones, which is 255.255.255.0. A /26 gives 255.255.255.192, a /23 gives 255.255.254.0, and a /16 gives 255.255.0.0. The table on this page lists the mask for each common prefix.
Yes. The mask 255.255.255.0 has 24 leading bits set to 1, so it equals /24. It means that the first three octets identify the network and the last octet identifies the host, which gives 256 addresses and 254 usable hosts.
The subnet mask of 192.168.1.1/24 is 255.255.255.0. The network address is 192.168.1.0, the broadcast address is 192.168.1.255, and the usable host range is 192.168.1.1 to 192.168.1.254.
The network address is the result of a bitwise AND of the IP address and the mask. The broadcast address is the network address with all host bits set to 1. For 192.168.1.130/26, the last octet 130 AND 192 equals 128, so the network address is 192.168.1.128 and the broadcast address is 192.168.1.191.
The first address of a block identifies the whole network, and the last address is the broadcast address, so neither is assigned to a device. That is why a classic subnet has two fewer usable hosts than total addresses.
A /31 and a /32 do not follow the "minus 2" rule. A /31 describes a point-to-point link with two addresses (RFC 3021), and a /32 is a single host address or a route to one host. The calculator shows a separate note for these results.
Yes. Enter any host address inside the subnet, such as 192.168.1.42, or use the address/prefix form. The calculator works out the canonical network address, so you do not need to know it in advance.
No. The calculator describes one IPv4 subnet from an address and a prefix. IPv6 addresses can be shortened with the separate IPv6 shortener, and splitting a larger network into several blocks has to be done step by step with one prefix at a time.
No. The calculator works on the numbers only. It does not query a network interface, send packets or run traceroute. The result describes an address block, not the state of a particular network.
No. Usable hosts are all the addresses that can be assigned in the subnet. A DHCP pool is usually a smaller part of that range, because routers, servers and devices with fixed addresses occupy some of the addresses.
The formulas and address ranges come from the IETF standards that describe IPv4 addressing and CIDR notation.
Page updated in 2026.