Ip Netmask Calculator
Subnet masks are the quiet workhorses of IPv4 networking. Every time a device decides whether a destination is on its local network or needs to go through the gateway, it performs that test with the subnet mask. Yet masks appear in two different notations: the CIDR prefix length like /24, and the dotted-decimal form like 255.255.255.0. Converting between them by hand means counting ones in binary, which is tedious and easy to get wrong. This IP netmask calculator converts any CIDR prefix into its dotted-decimal subnet mask instantly, and also shows the wildcard mask, the binary form, and the total address count.
The relationship is straightforward once you see it: the prefix length tells how many leading bits of the 32-bit mask are ones. A /24 means 24 ones followed by 8 zeros, which in dotted decimal is 255.255.255.0. The wildcard mask is the exact inverse, with zeros and ones swapped, and it is used in access control lists and some routing configurations. Seeing all of these representations side by side makes subnetting concepts click, whether you are configuring equipment or studying for a certification exam.
Network engineers, system administrators, students, and even home users setting up advanced router features all need mask conversions regularly. With this calculator, the answer is always one step away, with no binary math required.
How to Use This Calculator
- Enter the CIDR prefix. Type a number from 0 to 32, for example 24. This is the number after the slash in notation like 192.168.1.0/24.
- Click Calculate. The tool displays the dotted-decimal subnet mask, the wildcard mask, the 32-bit binary mask, and the total number of addresses in the block.
- Copy the value you need. Use the subnet mask for device and interface configuration, and the wildcard mask for access lists where required.
- Convert another prefix. Press Reset to clear the result and convert a different prefix length.
Worked Example
A student practicing subnetting wants to know the dotted-decimal mask for a /26 network.
The calculator builds a 32-bit value with 26 leading ones followed by 6 zeros: 11111111.11111111.11111111.11000000. Converting each octet to decimal gives 255.255.255.192, so the subnet mask is 255.255.255.192. The wildcard mask inverts every bit, giving 0.0.0.63. The total address count is 2^(32-26) = 64.
The student confirms that /26 equals 255.255.255.192, learns that its wildcard is 0.0.0.63, and verifies the block holds 64 addresses. These are exactly the conversions that appear on networking exams, now double-checked in seconds.
More Helpful Information
Reading a subnet mask. Each 255 octet means all 8 bits are network bits, each 0 octet means all 8 are host bits, and a middle value like 192, 224, 240, 248, or 252 indicates a partial octet. The valid partial values follow the pattern of leading ones: 128, 192, 224, 240, 248, 252, 254. Any other value in a mask position is invalid.
What the wildcard mask is for. The wildcard is the bitwise inverse of the subnet mask and appears in Cisco access control lists and OSPF network statements, where a 0 bit means “must match” and a 1 bit means “ignore.” For standard contiguous masks, the wildcard is simply 255.255.255.255 minus the subnet mask, octet by octet.
Memorizing common conversions. The masks you will meet most often are /8 = 255.0.0.0, /16 = 255.255.0.0, /24 = 255.255.255.0, /25 = 255.255.255.128, /26 = 255.255.255.192, /27 = 255.255.255.224, /28 = 255.255.255.240, /29 = 255.255.255.248, and /30 = 255.255.255.252. Knowing these by heart speeds up both real work and exams.
How masks divide networks. A device combines its own IP address with the mask to find its network address, then does the same for the destination. If both network addresses match, the destination is local; otherwise the packet goes to the gateway. This single operation, performed billions of times per second worldwide, is why the mask matters.
Non-contiguous masks. In theory a mask could have interleaved ones and zeros, but modern networking requires contiguous masks where all ones come first. If you ever encounter a non-contiguous mask, treat it as a configuration error.
Mistakes to avoid. The classic error is typing the wildcard mask where the subnet mask belongs, or vice versa, which breaks connectivity in confusing ways. Another is using a mask that does not match the intended prefix, such as configuring 255.255.255.0 on a /25 network, which merges two subnets into one broadcast domain.
Frequently Asked Questions
1. What does the IP netmask calculator convert?
It converts a CIDR prefix length (0-32) into the dotted-decimal subnet mask, and also shows the wildcard mask, binary mask, and total address count.
2. What is a subnet mask?
A 32-bit value that separates an IPv4 address into its network portion and host portion, written as four decimal octets like 255.255.255.0.
3. What is the difference between /24 and 255.255.255.0?
Nothing; they are two notations for the same mask. /24 is the CIDR prefix length and 255.255.255.0 is the dotted-decimal form.
4. What is a wildcard mask?
The bitwise inverse of the subnet mask, used in access control lists and certain routing configurations to specify which address bits must match.
5. How do I compute a wildcard from a subnet mask?
Subtract each octet of the subnet mask from 255. For 255.255.255.192, the wildcard is 0.0.0.63.
6. What does a /32 mask mean?
A /32 mask of 255.255.255.255 designates a single host with no network or host bits, used for loopbacks, host routes, and firewall rules.
7. What does a /0 mask mean?
A /0 mask of 0.0.0.0 matches every address and represents the default route, the path taken when no more specific route exists.
8. Why do masks only use certain numbers?
Valid masks have contiguous leading ones, so each octet can only be 0, 128, 192, 224, 240, 248, 252, 254, or 255. Other values indicate an error.
9. How many addresses does a /27 contain?
A /27 leaves 5 host bits, so it contains 2^5 = 32 total addresses, of which 30 are usable for hosts.
10. Where do I enter the subnet mask on my computer?
In the network adapter’s IPv4 properties alongside the IP address, gateway, and DNS servers, whenever you configure a static address.
11. Is the binary mask display useful?
Yes, especially for learning. Seeing the ones and zeros makes the relationship between the prefix length and the dotted-decimal value visually obvious.
12. Can subnet masks be written in other formats?
Hexadecimal notation exists but is rare. CIDR and dotted decimal cover essentially all practical configuration and documentation.
13. Do I need the netmask for DHCP clients?
No. DHCP servers supply the mask automatically along with the address, gateway, and DNS settings, so clients never type it.
14. What happens if two devices use different masks?
They may disagree about which addresses are local, causing one-way or intermittent connectivity that is notoriously difficult to diagnose.
15. Is this calculator helpful for certification exams?
Very. Prefix-to-mask conversion is foundational for CompTIA Network+ and Cisco CCNA, and this tool is perfect for verifying your manual practice.
CONCLUSION
Converting between CIDR prefixes and dotted-decimal masks is a task every networking practitioner performs constantly, and doing it by hand is an invitation to errors. This IP netmask calculator delivers the subnet mask, wildcard mask, binary representation, and address count for any prefix in a single step. Whether you are configuring devices, writing access lists, or preparing for a certification exam, keep this tool close and make mask conversion the easiest part of your day.