From prefix to mask
A prefix length counts the 1 bits at the start of the subnet mask. The rest of the 32 bits are 0. To convert, write that many ones, fill with zeros, and read the result in four groups of eight bits.
/26
11111111.11111111.11111111.11000000
255.255.255.192
The last group, 11000000, is 128 + 64, which is 192. So /26 is 255.255.255.192.
The wildcard mask
The wildcard mask is the subnet mask turned inside out: every 1 becomes 0 and every 0 becomes 1. For /26 it is 0.0.0.63. You meet wildcard masks in router access lists and in OSPF network statements, where a 0 bit means the address bit must match and a 1 bit means any value is allowed.
Counting addresses
The number of host bits is 32 minus the prefix length. The block holds 2 to the power of that many addresses. For /26 there are 6 host bits, so 64 addresses and 62 usable hosts once the network and broadcast addresses are set aside.
What you can enter
- A prefix on its own: 24 or /24
- A full CIDR block: 10.20.30.0/22. The tool then also shows the network and range.
- An IPv6 prefix length from 33 to 128, or a full IPv6 block. These show the size of the block and how many /64 networks it holds.
Every IPv4 prefix
The table below the converter lists all prefixes from /0 to /32 with their masks, wildcard masks and sizes, so you can look one up without typing.
To go the other way, use subnet mask to CIDR. For the full details of a block, use the CIDR calculator.