What is a subnet mask and how to calculate it
A subnet mask explained simply: what 255.255.255.0 and /24 mean, how to find the network, broadcast and number of hosts, with a table of common masks.
A subnet mask shows which part of an IP address identifies the network and which part identifies a device in it. Thanks to the mask, a computer knows whether to send a packet directly to a neighbor or through the router.
Example
Address 192.168.1.25 with mask 255.255.255.0:
- the first three numbers
192.168.1— the network; - the last number
25— the device (host) in this network.
All devices from 192.168.1.1 to 192.168.1.254 are in the same network and see each other directly.
What /24 means (CIDR notation)
A mask is 32 bits. /24 means the first 24 bits are ones (the network part), the rest are zeros:
255.255.255.0 = 11111111.11111111.11111111.00000000 = /24
The shorter the prefix, the larger the network.
Table of common masks
| Prefix | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 |
| /29 | 255.255.255.248 | 8 | 6 |
| /28 | 255.255.255.240 | 16 | 14 |
| /27 | 255.255.255.224 | 32 | 30 |
| /26 | 255.255.255.192 | 64 | 62 |
| /25 | 255.255.255.128 | 128 | 126 |
| /24 | 255.255.255.0 | 256 | 254 |
| /16 | 255.255.0.0 | 65 536 | 65 534 |
| /8 | 255.0.0.0 | 16 777 216 | 16 777 214 |
Two addresses in each network are reserved: the first is the network address, the last is the broadcast address.
How to calculate it by hand
- Number of addresses = 2^(32 − prefix). For /26: 2^6 = 64.
- The network starts at a multiple of this number. For
192.168.1.100/26: 100 ÷ 64 → the network starts at.64. - Network
192.168.1.64, broadcast192.168.1.127, hosts.65–.126.
It is faster to use our subnet calculator: enter an address and a mask, and get the network, broadcast, host range and number of addresses.
How to find your subnet mask
- Windows:
ipconfigin Command Prompt → “Subnet Mask”. - macOS: System Settings → Network → your connection → Details → TCP/IP.
- Linux:
ip addr— the mask is shown as a prefix, for example/24.
Subnets and proxies
Websites often treat addresses from the same subnet as related. If all your accounts use IPs from one /24, a website may link them. For multiple accounts, IPs from different subnets are safer. In IPv6 a single customer usually gets a whole /64, so many websites block IPv6 by subnet, not by address. See “IPv4 vs IPv6 proxies”.
Try ProxyZen
Private IPv4 and IPv6 for 3 to 90 days, residential and mobile per GB. Instant delivery, HTTP(S) and SOCKS5.