What Is a Subnet Mask? Explained Clearly
Learn what a subnet mask does, how it separates network and host portions of an IPv4 address, and how it relates to CIDR and usable ranges.
Tools For This Topic
What a subnet mask does
A subnet mask defines which part of an IPv4 address represents the network and which part represents the host. It helps devices decide whether a destination is local to the subnet or must be reached through a router.
Subnet masks are usually written in dotted decimal form, such as 255.255.255.0, but they can also be expressed as CIDR prefixes like /24.
How a subnet mask works
In binary terms, the 1 bits identify the network portion and the 0 bits identify the host portion. When a host applies the mask to an IP address, it can calculate the network address and decide which addresses belong to the same subnet.
IP address: 192.168.1.10
Subnet mask: 255.255.255.0
CIDR form: /24
Network: 192.168.1.0
Broadcast: 192.168.1.255
Usable hosts: 192.168.1.1 - 192.168.1.254Subnet mask examples
- 255.255.255.0 means /24 and provides 254 usable IPv4 hosts
- 255.255.255.128 means /25 and splits a /24 into two smaller networks
- 255.255.255.224 means /27 and provides 30 usable IPv4 hosts
- 255.255.255.252 means /30 and is often used for small point-to-point links
Why subnet masks matter
An incorrect subnet mask can cause traffic to break in subtle ways. A host may think a remote address is local and fail to use the gateway correctly, or it may send local traffic to the router unnecessarily.
Subnet masks also matter for capacity planning. They determine how many addresses a subnet can hold and whether the network design fits your environment.
Subnet masks and CIDR notation
CIDR notation is simply a shorter way to express the same boundary. Once you are comfortable converting between /24 and 255.255.255.0, the two become interchangeable in practice.
Common subnet mask mistakes
- Configuring devices in the same VLAN with different subnet masks
- Assuming the gateway is reachable just because the IP address looks similar
- Forgetting that changing the mask changes the network boundary and usable host range
- Copying cloud or firewall examples without checking whether the prefix overlaps an existing network
Most subnet mask issues show up as confusing connectivity problems rather than obvious DNS-style errors. If some hosts can talk locally and others cannot, the mask is one of the first settings worth checking.
Use These DNS Pro Tools
If you want to validate this topic in practice, these DNS Pro tools are the fastest next step.
Related Tools
Related Articles
What Is CIDR Notation? Explained with Examples
Learn what CIDR notation means, how slash prefixes like /24 and /27 define IP ranges, and how CIDR relates to subnet masks and routing.
How to Calculate a Subnet Range Step by Step
A practical guide to calculating network address, broadcast address, and usable host range from an IP address and subnet size.
CIDR Cheat Sheet for Common Subnet Sizes
Use this CIDR cheat sheet to quickly compare common subnet sizes, masks, block sizes, and usable host counts during subnet planning and troubleshooting.
