Skip to content

Networking

CIDR to Subnet Mask Calculator

Bidirectional converter between CIDR prefix notation (/24) and dotted-decimal subnet masks.

Subnet Mask: 255.255.255.0
Wildcard Mask: 0.0.0.255
Total IPs: 256
Usable Hosts: 254

CIDR Prefix Reference

Why /24 Means 255.255.255.0

The number after the slash is simply how many leading bits of the 32-bit address are fixed as the network part. A /24 sets the first 24 bits, which is three full octets of 255 followed by 0, so the mask is 255.255.255.0. A /26 sets 26 bits, so the last octet carries two network bits (128 + 64 = 192) and the mask becomes 255.255.255.192.

The remaining bits decide the size of the block. A /26 leaves 6 host bits, which gives 64 addresses, of which 62 are usable once the network and broadcast addresses are set aside. Use this when a firewall asks for a dotted mask but your cloud console only accepts a prefix, or the other way round.

Common Prefix Sizes in Real Networks

PrefixSubnet MaskUsable HostsTypical Use
/8255.0.0.016,777,214Very large private cores (rare in practice)
/16255.255.0.065,534Campus or VPC-level block
/20255.255.240.04,094AWS default VPC subnet
/24255.255.255.0254Standard office LAN
/26255.255.255.19262Small department or VLAN
/30255.255.255.2522Classic point-to-point router link
/31255.255.255.2542 (RFC 3021)Modern point-to-point link
/32255.255.255.2551 (host route)Loopback, VPN endpoint, route filtering

How the Network Math Works

  1. Translates prefix length into contiguous 32-bit subnet mask.
Formula & Technical Standard
Subnet Mask Octet = Sum of active bits in octet.

Worked Network Example

Prefix /28
Input: /28
Output: 255.255.255.240 | 14 Usable Hosts
4-bit host space yields 2^4 = 16 total IPs.

Common Questions

What is a wildcard mask?

The bitwise inverse of a subnet mask (~mask), used in Cisco ACLs.

How many addresses does a /28 contain?

A /28 leaves 4 host bits: 2^4 = 16 total addresses, minus 2 reserved (network and broadcast), equals 14 usable hosts. Prefixes like /24, /28, /30, and /31 are the most common in everyday routing.