A subnet mask is a 32-bit number, such as 255.255.255.0, that splits an IPv4 address into a network portion and a host portion. The ones in the mask mark network bits and the zeros mark host bits. The same boundary can be written in CIDR notation, so 255.255.255.0 is /24, meaning the first 24 bits identify the network.
Key takeaways
- A subnet mask divides an IPv4 address into network bits (ones) and host bits (zeros).
- CIDR notation such as /24 is the same boundary as 255.255.255.0, written more compactly.
- A /24 network holds 256 addresses and 254 usable hosts; each extra prefix bit halves the size.
Every device on your network has an IP address, but the address alone does not say which network it belongs to. That is the subnet mask's job: it draws the line between the part of the address that names the network and the part that names the device.
What is a subnet mask?
A subnet mask is a 32-bit number that pairs with an IPv4 address to separate the network portion from the host portion. It is written in the same dotted-decimal format as an IP address, such as 255.255.255.0.
Every subnet mask is made of 32 bits, each a 1 or a 0. The 1s mark the portion of the IP address reserved for identifying the network, while the 0s mark the portion available for identifying individual host devices.
Take the common example of 192.168.1.10 with a mask of 255.255.255.0. The mask tells the device that 192.168.1 is the network portion and .10 is the host portion. Any address starting 192.168.1 is on the same local network.
Subnet masks exist because networks need to be split into smaller, manageable pieces. Without them, a device would have no way to tell whether another address is local or must be sent through a router. That split is defined in the IPv4 standard, RFC 791.
How does a subnet mask work?
A subnet mask works by a bitwise AND operation: the device compares each bit of the IP address with the matching bit of the mask, and the result is the network address.
In binary, 255.255.255.0 is 11111111.11111111.11111111.00000000 — twenty-four 1s followed by eight 0s. Where the mask has a 1, the address bit is part of the network. Where it has a 0, the address bit can vary to identify a host.
When your device wants to reach another address, it applies the mask to both its own address and the destination address. If the network portions match, the destination is local and the device talks to it directly. If they differ, the traffic goes to the default gateway, usually your router.
That simple check is why a wrong subnet mask breaks a network. Set the mask too wide and the device tries to reach distant addresses directly and fails. Set it too narrow and it sends local traffic to the router unnecessarily, or cannot reach neighbors at all.
What is CIDR notation and what does /24 mean?
CIDR, Classless Inter-Domain Routing, is a shorthand way of writing a subnet mask by stating how many bits belong to the network. It is written as a slash followed by a number, such as /24.
A /24 means the first 24 bits of the address are the network portion, leaving 8 bits for hosts. In dotted decimal, /24 is exactly 255.255.255.0. The two formats describe identical information, just written differently.
CIDR replaced the older class-based system, which forced networks into fixed sizes called Class A, B and C. Classless addressing, documented in RFC 4632, lets networks be sized precisely, so a network can be exactly as large as it needs to be and no larger.
Modern tools and configuration screens mostly use CIDR. You will see 10.0.0.0/16, 192.168.1.0/24 and 172.16.0.0/12 in firewall rules, cloud consoles and router settings. Learning to read the number after the slash is the single most useful subnetting skill.
What are the common subnet masks?
Most networks you meet use one of a handful of masks. The table below lists them with the number of addresses and usable hosts each one provides.
| CIDR | Subnet mask | Total addresses | Usable hosts | Typical use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Very large networks |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large company networks |
| /24 | 255.255.255.0 | 256 | 254 | Home and small office |
| /25 | 255.255.255.128 | 128 | 126 | Half a /24 |
| /26 | 255.255.255.192 | 64 | 62 | Small department |
| /27 | 255.255.255.224 | 32 | 30 | Small team or VLAN |
| /28 | 255.255.255.240 | 16 | 14 | Point-to-point links, small groups |
| /30 | 255.255.255.252 | 4 | 2 | Router-to-router link |
Notice the pattern: every time the prefix length increases by one, the total number of addresses is halved. A /25 is half a /24, a /26 is a quarter, and so on.
The "minus 2" rule applies because two addresses in every conventional subnet are reserved: the network address itself (all host bits zero) and the broadcast address (all host bits one). A /31 and /32 are special cases with different rules, used for point-to-point links and single hosts.
How do you calculate hosts in a subnet?
Counting hosts takes two steps and one formula. First, count the host bits: 32 minus the prefix length. Then the total addresses are 2 raised to that number, and usable hosts are that total minus 2.
For a /26: 32 minus 26 is 6 host bits, so 2 to the power of 6 is 64 total addresses, and 64 minus 2 is 62 usable hosts. For a /24: 8 host bits, 2 to the power of 8 is 256 addresses, and 254 usable hosts.
To find the network address, set all host bits to zero. To find the broadcast address, set all host bits to one. In 192.168.10.0/24, the network address is 192.168.10.0, the broadcast address is 192.168.10.255, and usable hosts run from 192.168.10.1 to 192.168.10.254.
Splitting a larger block works the same way. Moving from /24 to /26 borrows two host bits for subnetting, and two borrowed bits produce 2 to the power of 2, or 4, subnets — each with 64 addresses and 62 usable hosts.
How do I find my subnet mask?
On Windows, open Command Prompt and run ipconfig; the mask is listed next to each adapter. On macOS, open System Settings, then Wi-Fi, then the details of your network. On Linux, run ip addr in a terminal.
On an iPhone, go to Settings, Wi-Fi, tap the information icon next to your network, and look for the subnet mask. On Android, the same detail appears under the connected network in Wi-Fi settings, sometimes shown as a prefix length such as /24.
Most home routers hand out 255.255.255.0 by default, which is fine for a household. If you see 255.255.0.0 or a /16 on a home network, it usually means the router is using a wider default range, which is also fine at that scale.
To check what the internet sees, our what is my IP tool shows your public address. Your subnet mask is a local setting, so it is not visible to the internet — only your public IP is.
Why does subnetting matter for security?
Subnetting is not just address bookkeeping; it is a security control. Splitting a flat network into subnets limits how far an attacker can move after getting in.
If every device sits on one large subnet, a compromised laptop can reach printers, servers and cameras directly. If departments, guests and servers sit on separate subnets with firewall rules between them, the same compromise is contained.
That is why home routers put guest Wi-Fi on a separate subnet, and why offices isolate servers from staff laptops. Segmentation, as this practice is called, is one of the cheapest defenses available.
Subnetting also improves performance. Broadcast traffic stays inside its own subnet instead of flooding the whole network, and routing tables stay smaller and faster. For a practical look at securing the network itself, see our guide on how to secure your Wi-Fi.
Common subnet mask mistakes
The most common mistake is mixing up the mask and the gateway. The mask defines the network boundary; the gateway is the router address that forwards traffic elsewhere. Both must be right, and they are different settings.
Another mistake is using a mask that is too wide for a segmented design, such as putting servers and guests on the same /16 and assuming a Wi-Fi password separates them. It does not — only a separate subnet and firewall rules do.
People also forget the reserved addresses. Assigning the network address or the broadcast address to a device causes confusing failures, because other devices treat those addresses specially.
Finally, do not assume a mask you memorized for IPv4 applies to IPv6. IPv6 uses prefix lengths only, and a /64 is the standard subnet size. Treating IPv6 like IPv4 is a fast route to a broken configuration.
The bottom line
A subnet mask is the line between the network and the host in an IPv4 address. Learn to read CIDR notation, remember that each extra prefix bit halves the network, and use the 2-to-the-power-of-host-bits formula when you need the size.
For most people, 255.255.255.0 — a /24 with 254 usable hosts — is all you will ever need to recognize. For everyone else, subnetting is the foundation that routing, firewalls and segmentation all stand on. You can check your own public address anytime with our free what is my IP tool.
Frequently asked questions
What is a subnet mask in simple terms?
A subnet mask is a number that tells a device which part of an IP address names the network and which part names the device itself. With 192.168.1.10 and a mask of 255.255.255.0, the network is 192.168.1 and the device is number 10 on it.
What is the most common subnet mask?
255.255.255.0, written as /24, is the most common mask on home and small office networks. It gives one network with 256 addresses, of which 254 can be assigned to devices.
What does /24 mean?
The /24 means the first 24 bits of the 32-bit IPv4 address identify the network, leaving 8 bits for hosts. It is the CIDR shorthand for the subnet mask 255.255.255.0.
How do I find my subnet mask?
On Windows run ipconfig in Command Prompt, on macOS and Linux run ifconfig or ip addr, and on a phone look under the Wi-Fi network details. Most home networks show 255.255.255.0.
How many hosts are in a /24 subnet?
A /24 subnet has 256 total addresses and 254 usable host addresses. The network address itself and the broadcast address are reserved, so you subtract 2 from the total.
Do IPv6 addresses use subnet masks?
IPv6 does not use dotted-decimal subnet masks. It uses prefix lengths only, such as /64, which is the standard size for a single IPv6 subnet. The idea is the same: the prefix identifies the network and the rest identifies the host.
What is the difference between a subnet mask and an IP address?
An IP address identifies one device on a network. A subnet mask does not identify a device at all; it defines the boundary between the network part and the host part of every address on that network.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 4632 on CIDR, RFC 791 on IPv4 addressing, and Linuxize and TP-Link subnetting guides.
How we write and fact-check →