CIDR & subnet calculator

—

Worked out in your browser. What you type is not sent anywhere. Every result has its own link: use Copy link to share it.

What CIDR notation means

A block like 192.168.1.0/24 is an address and a prefix length. The number after the slash says how many of the leading bits are fixed; the rest are free. IPv4 has 32 bits, so a /24 leaves 8 free: 28 = 256 addresses. Each step down the prefix doubles the block, and each step up halves it.

IPv4 subnet cheat sheet: every prefix from /0 to /32

CIDRNetmaskWildcardAddressesUsable hosts
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/3224.0.0.031.255.255.255536,870,912536,870,910
/4240.0.0.015.255.255.255268,435,456268,435,454
/5248.0.0.07.255.255.255134,217,728134,217,726
/6252.0.0.03.255.255.25567,108,86467,108,862
/7254.0.0.01.255.255.25533,554,43233,554,430
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

Usable hosts leave out the network and broadcast addresses, except /31 (RFC 3021) and /32. Link to any row: iphere.app/cidr/#slash-24.

IPv6 prefix sizes

/128One address: a single interface, or a loopback
/127A point-to-point link between two routers (RFC 6164)
/64One network. The standard size of an IPv6 subnet: 18,446,744,073,709,551,616 addresses, and what SLAAC needs
/6016 networks. What some providers give a home
/56256 networks. A common size for a home or small business
/4865,536 networks. A typical site or organisation
/3265,536 /48s. The usual minimum a registry gives a provider
/298 /32s. A larger provider
/16A huge range; 2002::/16 (6to4) is one
/32000::/3: all of the public IPv6 handed out so far

Questions

What is CIDR notation?

Classless Inter-Domain Routing writes a block of addresses as an address, a slash, and a prefix length: 192.168.1.0/24. The prefix length says how many leading bits are fixed. It replaced the old class A, B and C networks in 1993 and is defined today in RFC 4632.

How many hosts are in a /24?

256 addresses, of which 254 can be given to devices: the first is the network address and the last is the broadcast address. Its netmask is 255.255.255.0.

How many usable hosts are in a /29?

Eight addresses, six usable. A /30 has four addresses and two usable, which is why it was the classic size for a link between two routers - until /31 links became standard.

Why does a /31 have two usable addresses?

A /31 has only two addresses, and on a point-to-point link neither a network address nor a broadcast address is needed, so both are used. RFC 3021 made this standard in 2000.

How do I convert a netmask to CIDR?

Count the 1 bits in the mask. 255.255.255.0 is 24 ones, so /24; 255.255.252.0 is 22 ones, so /22. Type an address and a mask into the calculator above and it does this for you.

How do I turn an IP range into CIDR blocks?

A range only becomes one block if it starts on a boundary of its own size and is a power of two long. Otherwise it needs several. Type the range above, like 10.0.0.0 - 10.0.5.255, and the calculator returns the fewest blocks that cover it exactly.

What is a wildcard mask?

The netmask with every bit flipped: 0.0.0.255 for a /24. Cisco access lists and OSPF use it to say which bits may vary.

How big is an IPv6 subnet?

A /64, almost always: 264 addresses, about 18 quintillion. Automatic address configuration (RFC 4862) depends on that size, so IPv6 networks are not made smaller to save space the way IPv4 ones are.

See also

Is an IP address private or public? · IPv4 vs IPv6, and converting between them · What is my IP address, and the map of the whole address space around it.

Updated . Standards: RFC 4632 (CIDR), RFC 1918 (private ranges), RFC 3021 (/31 links), RFC 4291 (IPv6 addressing).