Netmask Calculator
The netmask is the value that draws the line between the network portion and the host portion of an IP address. Given any IP address and a CIDR prefix, every other detail of the network is determined: the network address, the broadcast address, the usable host range, and the address counts. The Netmask Calculator takes an IP address plus a CIDR prefix and instantly produces the complete network profile: netmask in dotted-decimal and binary form, wildcard mask, network and broadcast addresses, first and last usable IPs, total and usable host counts, IP class, and the full CIDR notation.
What a Netmask Is
A netmask is a 32-bit number made of a solid block of ones followed by a solid block of zeros. The ones mark the network portion of the address, the zeros mark the host portion. A /24 prefix corresponds to 24 ones, which is 255.255.255.0 in dotted decimal.
How to Use the Netmask Calculator
You only need two inputs:
- Enter the IP address (e.g. 192.168.1.1 or 10.0.0.50).
- Enter the CIDR prefix (1-32, e.g. 24).
- Click Calculate - result panel shows network address, netmask (decimal + binary), wildcard mask, broadcast, usable range, counts, class, and CIDR.
- Use the values (mask into device configs, network/broadcast into documentation, usable range into DHCP).
- Reset for the next lookup.
Worked Example: 192.168.1.1 With a /24 Prefix
Enter 192.168.1.1 and 24, click Calculate. A /24 means 24 network bits and 8 host bits - netmask 255.255.255.0, binary 11111111.11111111.11111111.00000000, wildcard 0.0.0.255. Network is 192.168.1.0, broadcast is 192.168.1.255, usable range 192.168.1.1 to 192.168.1.254 (254 hosts), Class C.
This is the classic home and small-office network: one /24 block with room for 254 devices.
More Helpful Information
The prefix-to-mask ladder
A handful of conversions appear so often that they are worth memorizing. /8 is 255.0.0.0, /16 is 255.255.0.0, /24 is 255.255.255.0. Each bit doubles the networks and halves the hosts.
Netmask versus wildcard mask
These two are easy to confuse because they are exact inverses. The netmask has ones where the network portion is, the wildcard has ones where the host portion is. For /24, netmask 255.255.255.0, wildcard 0.0.0.255.
Valid and invalid masks
A valid netmask is always a run of ones followed by a run of zeros. That is why each octet of a valid mask must be one of 0, 128, 192, 224, 240, 248, 252, 254, or 255. Anything else, like 255.0.255.0, is invalid.
Mistakes to avoid
The most common mistake is an off-by-one error in the prefix, such as using /25 when you meant /24. This halves or doubles the network size. Always double-check the prefix.
Netmasks in exams
Networking certification exams love netmask questions because they test whether you truly understand the binary math. Practice converting between prefix, decimal mask, and binary until it becomes second nature.
Frequently Asked Questions
Q1: What is a netmask?
A: A netmask is a 32-bit value of contiguous ones followed by contiguous zeros that separates an IP address into its network and host portions.
Q2: What is the netmask for /24?
A: The netmask for /24 is 255.255.255.0, which in binary is 24 ones followed by 8 zeros.
Q3: How do I convert a prefix length to a netmask?
A: Write out the prefix count of one-bits followed by zero-bits to fill 32 bits, then convert each 8-bit octet to decimal.
Q4: What is a wildcard mask?
A: The wildcard mask is the bitwise inverse of the netmask, used in access control lists to specify which bits to ignore.
Q5: What is the netmask for /26?
A: The netmask for /26 is 255.255.255.192, giving 62 usable hosts.
Q6: Can a netmask be 255.0.255.0?
A: No. A valid netmask must be contiguous ones followed by zeros; 255.0.255.0 has zeros between ones and is invalid.
Q7: How many host bits does a /20 have?
A: A /20 has 12 host bits, since 32 minus 20 equals 12.
Q8: What is the difference between a netmask and a subnet mask?
A: There is no difference; the terms are used interchangeably.
Q9: Why do access lists use wildcard masks?
A: Wildcard masks let an access list match ranges of addresses flexibly, such as 0.0.0.255 to match an entire /24.
Q10: What prefix corresponds to 255.255.255.240?
A: That mask is /28. It provides 14 usable hosts.
Q11: How many usable hosts does a /27 provide?
A: A /27 has 5 host bits, giving 30 usable hosts.
Q12: Is /31 a valid prefix?
A: Yes. A /31 has exactly 2 addresses with no reserved network or broadcast, used for point-to-point links.
Q13: What does a /32 netmask mean?
A: A /32 is 255.255.255.255, describing a single host route.
Q14: How can I memorize common netmasks?
A: Learn the last-octet ladder: /25 is 128, /26 is 192, /27 is 224, /28 is 240, /29 is 248, /30 is 252.
Q15: Do IPv6 networks use netmasks?
A: IPv6 uses prefix lengths like /64 rather than dotted-decimal netmasks.
Conclusion
Deriving a network's full details from an IP address and prefix is a daily task in networking, and the netmask is the key that unlocks it. Enter any IP and CIDR above to get the complete profile instantly.