Subnet mask cheat sheet

This page opens the full cheat sheet below the calculator: all 33 prefix lengths with dotted-decimal masks, wildcard masks for ACLs and OSPF, and host counts.

Binary

Split into subnets

    VLSM: hosts per subnet

    HostsSubnetRangeUsable

    IP range to CIDR

    –

    Subnet mask cheat sheet (/0 – /32)
    CIDRSubnet maskWildcardAddressesUsable hosts

    Saved you some time? Leave a tip, entirely optional.

    The most common ones are /24 (255.255.255.0), /16 (255.255.0.0) and /30 or /31 for point-to-point links.

    How IPv4 subnetting works

    An IPv4 address is a 32-bit number, written as four 8-bit octets such as 192.168.1.10. A subnet divides those bits into two parts: the network bits, which are the same for every device on the subnet, and the host bits, which identify each device. The prefix length in CIDR notation, such as /24, says how many bits belong to the network. The subnet mask expresses the same thing in dotted-decimal form, with ones for network bits and zeros for host bits: /24 is 255.255.255.0. SubnetMath applies the mask to your address to find the network address (all host bits zero) and the broadcast address (all host bits one), and everything in between is the usable host range.

    Counting hosts

    A prefix of /n leaves 32 − n host bits, so the subnet contains 2^(32 − n) addresses. Two of them, the network and broadcast addresses, are normally reserved, so a /24 has 256 addresses and 254 usable hosts, a /26 has 64 and 62, and a /30 has 4 and 2. RFC 3021 allows /31 networks on point-to-point links with both addresses usable, and a /32 is a single host, often used for loopbacks and host routes.

    Splitting networks and VLSM

    Borrowing host bits creates smaller subnets: a /24 split into /26 networks gives four subnets of 64 addresses. With variable-length subnet masking you can give each subnet a different size, so a 100-host office gets a /25 while a 20-host lab gets a /27. Allocating the largest first keeps every block on its natural boundary and avoids overlaps. Cloud networks reserve a few extra addresses per subnet (AWS keeps five), so leave some headroom.

    Wildcard masks, ranges and special blocks

    A wildcard mask is the inverse of the subnet mask and is used in router access lists and OSPF. When a firewall needs CIDR blocks rather than a start and end address, the range converter finds the smallest set of aligned blocks that covers the range exactly. The calculator also flags private RFC 1918 addresses, loopback, link-local, carrier-grade NAT, multicast and documentation ranges so you can spot mistakes before they reach production. Everything runs in your browser and nothing you type is sent anywhere.

    Frequently asked questions

    What is a wildcard mask?

    The inverse of the subnet mask, used in Cisco ACLs and routing protocols.

    How many hosts in a /27?

    32 addresses, 30 usable.

    Why use /31?

    RFC 3021 allows /31 on point-to-point links, saving two addresses per link.

    Is SubnetMath free?

    Yes, with no sign-up or ads.

    Does it work offline?

    Yes, once the page has loaded.

    More tools