Skip to content

Subnet Mask Cheat Sheet (CIDR, Masks & Host Counts)

Oct 7, 2026 · Web Development

If you’re searching for a subnet mask cheat sheet, you’ve come to the right place. This guide provides a practical reference for understanding subnet masks, CIDR notation, and calculating host counts in IPv4 networks.

Subnet Mask and CIDR Cheat Sheet

An IPv4 address is a 32-bit number, typically represented in dotted-decimal format (e.g., 192.168.1.1). A subnet mask is used to divide this address into a network portion and a host portion. The subnet mask consists of a series of 1s followed by 0s, where the 1s represent the network bits and the 0s represent the host bits. CIDR (Classless Inter-Domain Routing) notation, represented as /n, indicates that the first n bits of the address are the network portion.

To calculate the total number of addresses in a block, use the formula: 2^(32 − n). The number of usable hosts is this total minus 2, accounting for the network address and the broadcast address. However, /31 networks have 2 usable addresses (for point-to-point links, as per RFC 3021) and /32 networks represent a single host.

How to read this table

The table below shows the relationship between CIDR notation, subnet masks, total addresses, and usable hosts. The subnet mask can be expressed in dotted-decimal form or as a CIDR prefix. For example, /24 corresponds to 255.255.255.0, which provides 256 total addresses and 254 usable hosts.

CIDR Subnet mask Wildcard Total addresses Usable hosts
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214 usable
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606 usable
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302 usable
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150 usable
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574 usable
/13 255.248.0.0 0.7.255.255 524,288 524,286 usable
/14 255.252.0.0 0.3.255.255 262,144 262,142 usable
/15 255.254.0.0 0.1.255.255 131,072 131,070 usable
/16 255.255.0.0 0.0.255.255 65,536 65,534 usable
/17 255.255.128.0 0.0.127.255 32,768 32,766 usable
/18 255.255.192.0 0.0.63.255 16,384 16,382 usable
/19 255.255.224.0 0.0.31.255 8,192 8,190 usable
/20 255.255.240.0 0.0.15.255 4,096 4,094 usable
/21 255.255.248.0 0.0.7.255 2,048 2,046 usable
/22 255.255.252.0 0.0.3.255 1,024 1,022 usable
/23 255.255.254.0 0.0.1.255 512 510 usable
/24 255.255.255.0 0.0.0.255 256 254 usable
/25 255.255.255.128 0.0.0.127 128 126 usable
/26 255.255.255.192 0.0.0.63 64 62 usable
/27 255.255.255.224 0.0.0.31 32 30 usable
/28 255.255.255.240 0.0.0.15 16 14 usable
/29 255.255.255.248 0.0.0.7 8 6 usable
/30 255.255.255.252 0.0.0.3 4 2 usable
/31 255.255.255.254 0.0.0.1 2 2 (point-to-point, RFC 3021)
/32 0.0.0.0 255.255.255.255 1 1 (single host)

Private address ranges

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

These private ranges are reserved for use in private networks and are not routable on the public internet. You can use a domain analyzer to inspect and understand these ranges in more detail.

Splitting a /24 into smaller subnets

A /24 subnet, which contains 256 addresses, can be divided into smaller subnets by borrowing host bits for the network portion. Here are the common subdivisions:

  • Two /25 subnets: Each /25 subnet contains 128 addresses. This is done by using one bit from the host portion to create two networks.
  • Four /26 subnets: Each /26 subnet contains 64 addresses. This is achieved by using two bits from the host portion.
  • Eight /27 subnets: Each /27 subnet contains 32 addresses. This is done by using three bits from the host portion.
  • Sixteen /28 subnets: Each /28 subnet contains 16 addresses. This is achieved by using four bits from the host portion.
  • Thirty-two /29 subnets: Each /29 subnet contains 8 addresses. This is done by using five bits from the host portion.
  • Sixty-four /30 subnets: Each /30 subnet contains 4 addresses. This is achieved by using six bits from the host portion.

CIDR vs the old classful addresses

Before Classless Inter-Domain Routing (CIDR) was introduced, IP addresses were allocated based on a classful system:

  • Class A: These were large networks with a fixed subnet mask of /8, providing up to 16,777,214 host addresses per network.
  • Class B: These networks had a fixed subnet mask of /16, offering up to 65,534 host addresses per network.
  • Class C: These were smaller networks with a fixed subnet mask of /24, providing up to 254 host addresses per network.

CIDR replaced this rigid system by allowing any prefix length, which provides more flexibility in allocating address space. This change enabled more efficient use of the IPv4 address space and facilitated route aggregation.

VLSM in one line

Variable-Length Subnet Masking (VLSM) allows different subnets within the same network to use different prefix lengths, tailoring the subnet size to fit the number of hosts required for each subnet.

This means that a network can be divided into smaller subnets with varying sizes, optimizing the use of the address space and reducing waste. For example, a network administrator can allocate a /30 subnet for point-to-point links, a /25 subnet for larger departments, and a /28 subnet for smaller groups, all within the same network.

Using QuikConsole’s Free Subnet Calculator

For a hands-on approach to working with subnet masks and CIDR notation, you can use QuikConsole’s free, browser-based Subnet calculator. This tool allows you to input your network parameters and instantly see the results, without any data leaving your browser.

Worked example

To illustrate how subnet masks work in practice, consider the network address 192.168.1.0/24:

  • Total addresses: 256
  • Network address: 192.168.1.0
  • Broadcast address: 192.168.1.255
  • Usable hosts: 254 (from 192.168.1.1 to 192.168.1.254)

In this example, the subnet mask is /24, which translates to 255.255.255.0 in dotted-decimal notation. This means the first 24 bits of the IP address are used for the network portion, and the remaining 8 bits are for host addresses.

Here’s a breakdown of the addresses:

Network address:    192.168.1.0
First usable host:  192.168.1.1
Last usable host:   192.168.1.254
Broadcast address:  192.168.1.255

This division ensures that there are 254 addresses available for devices on the network, with the first and last addresses reserved for network and broadcast purposes, respectively.

Why usable = total − 2

The formula for calculating the number of usable host addresses in a subnet is:

Usable hosts = Total addresses − 2

This is because two addresses in every subnet are reserved and cannot be assigned to hosts:

  1. Network address: The address with all host bits set to zero (e.g., 192.168.1.0 in the example above) is used to identify the network itself and cannot be assigned to a host.
  2. Broadcast address: The address with all host bits set to one (e.g., 192.168.1.255 in the example) is used to send broadcast messages to all hosts on the network and is also not assignable.

However, there are exceptions to this rule:

  • /31 networks: In a subnet with a prefix length of 31 (/31), there are only two addresses. In this case, both addresses are usable because there are no host bits left for assignment. RFC 3021 allows this configuration for point-to-point links.
  • /32 networks: A subnet with a prefix length of 32 (/32) represents a single IP address and is typically used for loopback addresses or for assigning a single address to a host.

For all other subnet sizes, the rule of subtracting two from the total number of addresses holds true.

Frequently asked questions

What is a subnet mask and how is it used?

A subnet mask is a 32-bit number that divides an IP address into a network portion and a host portion. It is used to determine which part of the IP address is the network address and which part is the host address.

How do I convert CIDR notation to a subnet mask?

CIDR notation /n corresponds to a subnet mask with n 1s followed by (32 – n) 0s. For example, /24 translates to 255.255.255.0.

How do I calculate the number of usable hosts in a subnet?

The number of usable hosts is calculated as 2^(32 – n) – 2, where n is the CIDR prefix length. This accounts for the network and broadcast addresses.

What are the private IPv4 address ranges?

The private IPv4 address ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These ranges are reserved for use in private networks.

What is the difference between /31 and /32 subnet masks?

A /31 subnet mask allows for 2 usable addresses for point-to-point links, while a /32 mask represents a single host with no additional addresses.

Frequently asked questions

What is a subnet mask and how is it used?

A subnet mask is a 32-bit number that divides an IP address into a network portion and a host portion. It is used to determine which part of the IP address is the network address and which part is the host address.

How do I convert CIDR notation to a subnet mask?

CIDR notation /n corresponds to a subnet mask with n 1s followed by (32 - n) 0s. For example, /24 translates to 255.255.255.0.

How do I calculate the number of usable hosts in a subnet?

The number of usable hosts is calculated as 2^(32 - n) - 2, where n is the CIDR prefix length. This accounts for the network and broadcast addresses.

What are the private IPv4 address ranges?

The private IPv4 address ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These ranges are reserved for use in private networks.

What is the difference between /31 and /32 subnet masks?

A /31 subnet mask allows for 2 usable addresses for point-to-point links, while a /32 mask represents a single host with no additional addresses.

Contact: contact@quikconsolecom.net