CIDR Notation Converter
Convert between CIDR prefixes and dotted-decimal subnet masks instantly. Enter a prefix like /24 to get the subnet mask, or enter a mask like 255.255.255.0 to get the CIDR notation. You'll also see the wildcard mask, binary representation, host counts, and bit layout — plus a full /0 to /32 reference table.
CIDR / Subnet Mask Reference Table
All 33 IPv4 CIDR prefixes with their equivalent subnet mask, wildcard mask, and host counts. Note: /31 has 2 usable hosts per RFC 3021, and /32 is a single-host route.
| CIDR | Subnet Mask | Wildcard | Total Addrs | Usable Hosts | Host Bits |
|---|
What Is CIDR Notation?
CIDR stands for Classless Inter-Domain Routing. It is a method for
allocating IP addresses and routing IP packets that replaced the older class-based system
(Class A, B, C). CIDR notation expresses a network as an IP address followed by a slash and
the number of network bits — for example, 192.168.1.0/24. The number after the
slash is called the CIDR prefix.
The prefix tells you how many of the 32 bits in an IPv4 address are used for the network portion. The remaining bits identify individual hosts. CIDR notation is used everywhere in modern networking — in routing tables, firewall rules, cloud security groups, and subnet planning.
How to Convert CIDR to Subnet Mask
A CIDR prefix /N means the first N bits of the subnet mask are 1
and the remaining 32 − N bits are 0. Convert each 8-bit group to decimal and
join with dots:
Example — /24: 24 ones followed by 8 zeros
11111111.11111111.11111111.00000000
= 255.255.255.0
The wildcard mask is simply the inverse: flip every bit of the subnet mask.
For 255.255.255.0, the wildcard is 0.0.0.255. Wildcard masks are
used in Cisco ACLs and OSPF configuration.
How to Convert Subnet Mask to CIDR
To go the other way, write the subnet mask in binary and count the leading 1 bits. A valid subnet mask must be contiguous — all 1s followed by all 0s with no gaps. For example:
255.255.255.0→11111111.11111111.11111111.00000000→ /24255.255.255.192→11111111.11111111.11111111.11000000→ /26255.255.240.0→11111111.11111111.11110000.00000000→ /20
If the binary mask has a 1 after a 0 (e.g., 255.255.255.64), it is not a valid
subnet mask. This converter will reject it.
Calculating Host Counts from CIDR
The number of addresses in a subnet is 2host bits, where
host bits = 32 − prefix. The number of usable hosts subtracts
the network address and broadcast address:
- /24 → 28 = 256 total → 254 usable
- /26 → 26 = 64 total → 62 usable
- /30 → 22 = 4 total → 2 usable
- /31 → 2 total → 2 usable (RFC 3021 point-to-point)
- /32 → 1 total → 1 usable (single host route)
Why Use This CIDR Notation Converter?
- Bidirectional: Convert CIDR to mask and mask to CIDR.
- Full details: See the wildcard mask, binary, host counts, network, and broadcast addresses.
- Validation: Rejects non-contiguous masks with a clear error.
- Complete reference: Full /0 to /32 table with all related values.
- Free & private: Everything runs in your browser — no data is sent to a server.
❓ CIDR Notation Converter FAQ
What is a CIDR prefix?
The CIDR prefix is the number after the slash in CIDR notation (e.g., the 24 in 192.168.1.0/24). It indicates how many of the 32 bits in the IPv4 address are used for the network portion. The remaining bits are host bits.
What is the difference between CIDR and subnet mask?
Both describe the same thing — how many bits belong to the network vs. the host. CIDR is just a shorthand: /24 and 255.255.255.0 are equivalent. CIDR notation is more compact and is used in routing tables and modern configuration tools.
How do I convert a CIDR prefix to a subnet mask?
Write the prefix as that many 1-bits followed by 0-bits to reach 32. For /26, that's 26 ones and 6 zeros: 11111111.11111111.11111111.11000000 = 255.255.255.192.
How do I convert a subnet mask to CIDR?
Convert the mask to binary and count the leading 1 bits. 255.255.254.0 = 11111111.11111111.11111110.00000000 = 23 ones = /23. The mask must be contiguous (all 1s then all 0s) to be valid.
What is a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask. It has 1s where the subnet mask has 0s, and vice versa. Wildcard masks are used in Cisco access control lists (ACLs), OSPF network statements, and some other routing and security configurations.
Why does /31 have 2 usable hosts?
Per RFC 3021, a /31 subnet can be used for point-to-point links. Both addresses in the subnet are usable as hosts, and there is no network or broadcast address. This is common on router-to-router links to save address space.
Why does /32 have only 1 usable host?
A /32 subnet represents a single host — there are no network, broadcast, or other host addresses. It's typically used for loopback interfaces, host routes, and as the target of a specific static route.
Can a subnet mask have non-contiguous bits?
No — for standard subnetting, the mask must be contiguous: all 1s followed by all 0s. A mask like 255.255.0.255 or 255.0.255.0 is not a valid subnet mask. This converter will reject such inputs.
What does /0 mean?
/0 means all 32 bits are host bits, representing the entire IPv4 address space (0.0.0.0/0). It's used as the default route in routing tables and in firewall rules that should match every address.
What is the highest CIDR prefix?
For IPv4, the highest prefix is /32 (a single host). For IPv6, prefixes range from /0 to /128, since IPv6 addresses are 128 bits long. This tool covers IPv4 only, so it goes from /0 to /32.
What is the difference between CIDR and VLSM?
CIDR is the notation for specifying prefix lengths. VLSM (Variable Length Subnet Masking) is the practice of using different prefix lengths within the same network to allocate address space efficiently. This tool converts CIDR notation; a VLSM calculator helps plan subnets of different sizes.
Is this CIDR converter free?
Yes. This tool is completely free, requires no registration, and runs entirely in your browser. Your inputs are never sent to a server.