CIDR / Subnet Mask Converter
Convert between CIDR prefix, subnet mask and wildcard mask instantly, find the smallest prefix for the hosts you need, and browse the complete /0 to /32 reference table.
How to use the CIDR / Subnet Mask Converter
- Type a prefix (/26), a mask (255.255.255.192) or a wildcard (0.0.0.63).
- Or enter how many hosts you need to get the smallest network.
- Click any row of the table to see it highlighted.
Most used prefixes
- /30 — 2 hosts (router links)
- /29 — 6 hosts
- /28 — 14 hosts
- /27 — 30 hosts
- /26 — 62 hosts
- /25 — 126 hosts
- /24 — 254 hosts
Frequently asked questions
What is /24 as a subnet mask?
255.255.255.0.
How do I convert a mask to CIDR?
Count the 1-bits in the mask. 255.255.255.192 has 26 ones, so it is /26.
What is a wildcard mask?
The inverse of the subnet mask, used in Cisco ACLs. 255.255.255.0 becomes 0.0.0.255.
Which prefix do I need for 50 hosts?
/26, which gives 62 usable hosts.
Why is 255.255.0.255 invalid?
A subnet mask must be continuous ones followed by zeros.
Is anything sent to a server?
No. All calculations run in your browser on your own device.
How to use the CIDR and subnet mask converter
- Enter a CIDR prefix such as /24, or a subnet mask such as 255.255.255.0.
- Read the matching mask, wildcard mask and number of usable hosts.
- To size a new network, enter how many hosts you need and the tool finds the smallest prefix that fits.
Quick reference
A /24 equals the mask 255.255.255.0, the wildcard 0.0.0.255, and 254 usable hosts. Each step smaller doubles the space: a /23 gives 510 usable hosts and a /22 gives 1,022. Going the other way, a /30 gives just 2 usable hosts, which is common for point-to-point links.
The formula is 2 to the power of (32 minus the prefix), minus 2 for the network and broadcast addresses. A /31 and a /32 are special cases used for links and single hosts.
Quick questions
What is a wildcard mask used for? Cisco access lists and OSPF use it. It is the subnet mask flipped: 255.255.255.0 becomes 0.0.0.255.
Does this work for IPv6? No, it is for IPv4. Use our IPv6 Formatter for IPv6 addresses.