%3C/text%3E%3C/svg%3E">
💻
💻 Tech & IT

CIDR ⇄ Subnet Mask ⇄ Host Count Converter

Results update as you type.

Your numbers

Understanding the CIDR to subnet mask converter — concept and principle

This converter turns a CIDR prefix length (/0 to /32) into the equivalent dotted-decimal subnet mask, its wildcard mask, the total number of addresses in the block, the number of usable host addresses and the mask written out in binary. It is the quick reference you need when a router asks for "255.255.240.0" but your documentation says "/20", or when you need to know whether a block is big enough for a site.

The /20 mask written bit by bitTwenty 1-bits give 255.255.240.0; the twelve 0-bits give 4,096 addresses, 4,094 usable./20 = twenty 1s, then twelve 0soctet 111111111= 255octet 211111111= 255octet 311110000= 240128+64+32+16octet 400000000= 0mask 255.255.240.0 · wildcard 0.0.15.25512 host bits → 4,0962¹² addresses · 4,094 usable hosts
Each octet of the mask is just eight bits read as a number; /20 leaves 12 bits for hosts.

How it is calculated

The only octet values a valid mask can contain are 0, 128, 192, 224, 240, 248, 252, 254 and 255, because the ones must be contiguous from the left.

The principle

CIDR replaced the old fixed class boundaries with a simple rule: the network part is whatever the first n bits are. The mask is just a compact way of writing n. Every bit you move from the network side to the host side doubles the block size, which is why /24 holds 256 addresses, /23 holds 512 and /20 holds 4,096. The two reserved addresses (all-zeros host part for the network, all-ones for broadcast) are why the usable count is two less than the total for ordinary subnets.

Worked example

  1. Input: /20.
  2. The first 16 bits fill two octets with 255. Four more bits remain in the third octet: 11110000 = 128 + 64 + 32 + 16 = 240. The last octet is 0.
  3. Mask: 255.255.240.0. Binary: 11111111.11111111.11110000.00000000.
  4. Wildcard: 255 − 240 = 15 and 255 − 0 = 255, so 0.0.15.255.
  5. Total addresses: 2^(32 − 20) = 2^12 = 4,096. Usable hosts: 4,096 − 2 = 4,094.
How Subnet mask changes with Prefix /nHow Subnet mask changes with Prefix /n2482502522542565101520253040Example: 255.255.240.0Prefix /n
Each point is the calculator re-run with only “Prefix /n” changed; the gold point is the default example. Change the inputs above and this chart follows your numbers.
Prefix /nSubnet mask
5248.0.0.0
10255.192.0.0
15255.254.0.0
20255.255.240.0
25255.255.255.128
30255.255.255.252
40255.0.0.0

How to read the result

Each step down in prefix length doubles capacity: /30 = 2 hosts, /29 = 6, /28 = 14, /27 = 30, /26 = 62, /25 = 126, /24 = 254, /22 = 1,022, /20 = 4,094, /16 = 65,534. A /20 block covers 16 consecutive /24 networks, so its third octet must start at a multiple of 16. Choose the smallest block that holds your hosts plus growth room.

Common mistakes

Keep in mind: This shows the arithmetic of a prefix only. Whether a block is routable or available depends on your provider, your routing design and address registry policy.

Frequently asked questions

What mask is /20?

255.255.240.0, with 4,096 addresses and 4,094 usable hosts.

How many /24 networks fit in a /20?

Sixteen, because 2^(24 − 20) = 16.

What is a wildcard mask used for?

Some ACL and OSPF syntax uses it: a 0 bit must match, a 1 bit is ignored.

Why does /0 have no usable host count meaning?

/0 (0.0.0.0/0) represents the whole IPv4 space and is used as the default route, not as a subnet you assign hosts in.

Sources: IETF RFC 4632, Classless Inter-domain Routing (CIDR) · IETF RFC 950, Internet Standard Subnetting Procedure

Checked 8 Nov 2026. Standard formulas and RFC/IEEE definitions, computed locally in your browser — nothing you type is sent anywhere.

💻 All tech & IT tools →🌍 Calculators by country →