Subnet Mask Calculator
Calculate an IPv4 subnet mask from any CIDR prefix and see exactly how the mask divides network bits from host bits. This visual subnet mask calculator updates instantly as you move between /0 and /32.
Subnet masks and CIDR prefixes
A subnet mask and a CIDR prefix describe the same network boundary in different notation. A /24 prefix corresponds to 255.255.255.0 because the first 24 mask bits are set to one. A /26 corresponds to 255.255.255.192, leaving six host bits and 64 total addresses.
Subnet masks are common in operating-system network settings, routers, firewalls and older network documentation. CIDR prefixes are shorter and are widely used in routing tables, cloud networks and infrastructure configuration.
How a subnet mask is calculated
Start with 32 binary positions. Set the number of leading bits specified by the CIDR prefix to 1 and set the rest to 0. Split those bits into four groups of eight, convert each octet to decimal and you have the dotted-decimal subnet mask.
Subnet mask example
The binary mask for /26 is 11111111.11111111.11111111.11000000. Converting each octet to decimal gives 255.255.255.192. Its wildcard mask is the inverse: 0.0.0.63.
Why subnet masks matter
The mask tells a host which part of an IP address identifies the local network. Devices compare the destination address with the local network prefix to decide whether traffic can be delivered directly on the local network or must be sent to a router.
What this calculator shows
The result panel reports the canonical network address, broadcast address, first and last conventional usable addresses, dotted-decimal subnet mask, wildcard mask, total IPv4 address count and usable-host count. The live 32-bit boundary updates with the CIDR prefix, so the relationship between prefix length, block size and address capacity is visible instead of hidden behind a static table.
How to read the result correctly
The calculator normalizes the IP address you enter to the network block that contains it. That means an input such as 192.168.1.42/24 correctly resolves to network 192.168.1.0/24. For prefixes /0 through /30, conventional IPv4 subnetting reserves the first address as the network identifier and the final address as broadcast. /31 and /32 have different practical semantics, so their address counts should not be interpreted with the ordinary “subtract two” rule.
Related subnet tools
You can also use the subnetting cheat sheet for a complete IPv4 prefix reference, browse individual CIDR prefix pages, try the IPv6 subnet calculator, or return to the main visual subnet calculator.
Frequently asked questions
What does a subnet mask of 255.255.255.0 mean?
255.255.255.0 is a /24 subnet mask. It uses 24 network bits and 8 host bits, giving 256 total addresses in the subnet.
What subnet mask is /26?
/26 is 255.255.255.192. It leaves 6 host bits, so the block contains 64 total addresses.
How do I convert CIDR to a subnet mask?
Set the first N bits to 1, where N is the CIDR prefix, set the remaining bits to 0, then convert the four binary octets to decimal.