How to Find the Network Mask From an IP Address
Every device on a network needs two key pieces of information to communicate properly: its IP address and its subnet mask (also called the network mask). While your IP address identifies your device, the subnet mask tells your device — and the network — which part of that address refers to the network itself and which part identifies your specific device within it.
Finding the network mask from an IP address isn't always a single-step process. Sometimes it's printed right alongside the IP. Other times, you need to dig into your operating system settings, understand the address class, or apply some binary logic. Here's how it all works.
What a Network Mask Actually Does
A subnet mask is a 32-bit number (for IPv4) that runs alongside an IP address. It separates the network portion from the host portion of the address.
For example:
- IP Address: 192.168.1.45
- Subnet Mask: 255.255.255.0
The 255 octets mean "this part belongs to the network." The 0 means "this part identifies the individual device." So in this case, 192.168.1 is the network, and .45 is the host.
Without a subnet mask, a device doesn't know whether a destination IP is on the same local network or needs to be routed out through a gateway.
Method 1: Look Up the Mask Directly on Your Device 🔍
The fastest way to find the network mask associated with your IP address is to check your device's network settings.
On Windows:
- Open Command Prompt
- Type ipconfig and press Enter
- Look for Subnet Mask listed under your active network adapter
On macOS or Linux:
- Open Terminal
- Type ifconfig (macOS/older Linux) or ip addr (modern Linux)
- Look for the netmask value or the prefix length (e.g., /24)
On Android or iOS: Go to Settings → Wi-Fi → tap your connected network → look for the subnet mask under IP configuration details.
These methods show the mask currently assigned to your IP by your router or network administrator — no calculation needed.
Method 2: Use CIDR Notation to Derive the Mask
Modern networks often express the subnet mask using CIDR notation — a slash followed by a number appended to the IP address, like 192.168.1.45/24.
The number after the slash tells you how many bits in the 32-bit address are reserved for the network. From that, you can derive the full mask:
| CIDR Prefix | Subnet Mask | Common Use |
|---|---|---|
| /8 | 255.0.0.0 | Large networks (Class A) |
| /16 | 255.255.0.0 | Medium networks (Class B) |
| /24 | 255.255.255.0 | Home/small office networks |
| /25 | 255.255.255.128 | Split subnets |
| /30 | 255.255.255.252 | Point-to-point links |
A /24 prefix means the first 24 bits are the network — which equals 255.255.255.0 in dotted-decimal form. If someone hands you an IP in CIDR format, the mask is embedded in that number.
Method 3: Use the IP Address Class as a Starting Point
Before CIDR became standard, IPv4 addresses were grouped into classful categories, each with a default subnet mask. While classful networking is largely obsolete in modern routing, these defaults still appear in many basic home and small business setups.
- Class A — First octet: 1–126 → Default mask: 255.0.0.0
- Class B — First octet: 128–191 → Default mask: 255.255.0.0
- Class C — First octet: 192–223 → Default mask: 255.255.255.0
If your IP is 10.0.0.25, you're in Class A territory, so the default mask is 255.0.0.0 — unless the network administrator has applied custom subnetting.
This method gives you a reasonable starting guess, but it doesn't account for modern variable-length subnetting. Treat it as a baseline, not a definitive answer.
Method 4: Use an Online Subnet Calculator
If you have an IP address in CIDR format and want to verify all subnet details — including the mask, network address, broadcast address, and host range — online subnet calculators do this instantly. You paste in something like 172.16.5.10/20 and get the full breakdown.
These tools are especially useful for network administrators working with custom subnet designs, or for anyone troubleshooting routing issues across multiple subnets.
What Affects Which Mask You'll See ⚙️
The network mask isn't hardcoded into the IP address itself — it's assigned by the network and can vary depending on several factors:
- DHCP configuration — Your router or DHCP server assigns both the IP and mask automatically. Home routers almost always assign a /24 mask.
- Static IP configuration — If an IT team has manually configured a device's IP, they set the mask too. This varies widely in business environments.
- Network segmentation — Large organizations subnet their networks into smaller blocks, so masks like /26 or /27 are common even within the same building.
- ISP-assigned addresses — For public-facing IP addresses, your ISP assigns the mask, and it may not follow default class rules at all.
- IPv6 — IPv6 uses a different prefix notation entirely. The concept of a "mask" doesn't translate directly; instead, prefix lengths like /64 are standard.
When the IP Alone Isn't Enough
Here's the honest limitation: an IP address by itself doesn't tell you the subnet mask. The address 10.20.30.40 could be running under 255.0.0.0, 255.255.0.0, or 255.255.255.0 — or something more granular — depending entirely on how the network was designed.
The mask lives in the network configuration, not in the IP digits themselves. That means whether you're diagnosing a connectivity issue, setting up a static IP, or designing a network layout, the right mask for your situation depends on the specific network environment you're working within — and no formula applied to the IP address alone will reliably tell you that.