The Only IPv4 Subnetting Cheat Sheet You’ll Ever Need

IPv4 Subnet Cheat Sheet

Our beginner networking students often describe IPv4 subnetting as the most difficult concept to grasp. It can certainly be confusing, but it is necessary for any entry-level networking certification. Mastering IPv4 subnetting will also make you more efficient in network administration and design.

With that, we hope our IPv4 subnetting cheat sheet will be a great reference for you in your studies and career.

Click to download a pdf copy here to keep with you, and when you’re ready, read on.

IPv4 Subnetting Cheat Sheet Search

Search our IPv4 Subnetting cheat sheet to find the right cheat for the term you're looking for. Simply enter the term in the search bar and you'll receive the matching cheats available.

IPv4 Subnets

Subnetting allows a computer/host to know if the machine it wants to talk to is local or outside of its network. The subnet mask determines how many IPv4 addresses can be assigned within a network.

CIDRSUBNET MASKOF ADDRESSESWILDCARD
/32255.255.255.25510.0.0.0
/31255.255.255.25420.0.0.1
/30255.255.255.25240.0.0.3
/29255.255.255.24880.0.0.7
/28255.255.255.240160.0.0.15
/27255.255.255.224320.0.0.31
/26255.255.255.192640.0.0.63
/25255.255.255.1281280.0.0.127
/24255.255.255.02560.0.0.255
/23255.255.254.05120.0.1.255
/22255.255.252.010240.0.3.255
/21255.255.248.02,0480.0.7.255
/20255.255.240.04,0960.0.15.255
/19255.255.224.08,1920.0.31.255
/18255.255.192.016,3840.0.63.255
/17255.255.128.032,7680.0.127.255
/16255.255.0.065,5360.0.255.255
/15255.254.0.0131,0720.1.255.255
/14255.252.0.0262,1440.3.255.255
/13255.248.0.0524,2880.7.255.255
/12255.240.0.01,048,5760.15.255.255
/11255.224.0.02,097,1520.31.255.255
/10255.192.0.04,194,3040.63.255.255
/9255.128.0.08,388,6080.127.255.255
/8255.0.0.016,777,2160.255.255.255
/7254.0.0.033,554,4321.255.255.255
/6252.0.0.067,108,8643.255.255.255
/5248.0.0.0134,217,7287.255.255.255
/4240.0.0.0268,435,45615.255.255.255
/3224.0.0.0536,870,91231.255.255.255
/2192.0.0.01,073,741,82463.255.255.255
/1128.0.0.02,147,483,648127.255.255.255
/00.0.0.04,294,967,296255.255.255.255

Decimal to Binary

While IPv4 addresses appear to be four sets of numbers separated by decimals, they are actually made up of 32 ones and zeros. Understanding this will assist you in setting up your networks and is required on both the CompTIA Network+ and Cisco Certified Network Associate exams.

SUBNET MASKWILDCARD
255  1111 11110  0000 0000
254  1111 11101  0000 0001
252  1111 11003  0000 0011
248  1111 10007  0000 0111
240  1111 000015  0000 1111
224  1110 000031  0001 1111
192  1100 000063  0011 1111
128  1000 0000127  0111 1111
0  0000 0000255  1111 1111
IPv4 Subnet Cheat Sheet

Why Learn Binary?

Subnet masks determine which part of the IP address is for the network, and which is for the host. We can view this when examining the subnet mask in binary format. Any binary digit that is a “1” is for the network, while a “0” is for the host. 

*Note that subnet masks can only be written with all ones followed by all zeros.*

Subnet mask

The above example is called a /24 (pronounced whack 24) subnet because there are 24 binary digits in the “1” (or network) position. So, the first 24 binary digits (or three octets) of an IP range are for the network (non-changing), and the last eight binary digits (last octet) are for the hosts.

In this next example, our internet provider gave us an IP range of 199.44.6.0 with a /24 subnet, allowing 254 IP addresses. 

*Remember that hosts cannot have an IP address that ends in the first or last number in the available range.*

whack 24 example

Classful addressing will use the following subnet masks. 

255.0.0.0/8

255.255.0.0/16

255.255.255.0/24

These are very easy to calculate.

But what if we want a /28 subnet mask, for instance?

In this example, our internet provider gave us a different subnet mask (/28). We see the first 28 binary digits are in the one position. They also gave us an IP range of 199.44.6.80. 

How many hosts can we have now?

whack 28 example

Why is this? We know the first four binary characters are part of the network, so cannot change. 01010000 converts to 80, our first IP in the range. We now look at all available combinations of the next four binary positions.

First FourFifthSixthSeventhEighthDecimal
0101000181
0101001082
0101001183
0101010084
0101010185
0101011086
0101011187
0101100088
0101100189
0101101090
0101101191
0101110092
0101110193
0101111094

Without understanding decimal to binary, this would be a very difficult calculation.

IPv4 Address Classes

These were the first effort to divide network IDs and set how many public IPv4 addresses you can have.

A0.0.0.0 – 127.255.255.255
B128.0.0.0 – 191.255.255.255
C192.0.0.0 – 223.255.255.255
D224.0.0.0 – 239.255.255.255
E240.0.0.0 – 255.255.255.255

Reserved (Private) IP Ranges

These IP address ranges are reserved for internal networks. You will never see public IPv4 addresses in these ranges.

CLASS A10.0.0.0 – 10.255.255.255
CLASS B172.16.0.0 – 172.31.255.255
CLASS C192.168.0.0 – 192.168.255.255
LOCALHOST127.0.0.0 – 127.255.255.255
ZEROCONF (APIPA/BONJOUR)169.254.0.0 – 169.254.255.255

Terminology

If you want to discuss IPv4, you need to learn the following terms.

WILDCARD MASKA wildcard mask indicates which parts of an IP address are available for examination.
CIDRClassless interdomain routing was developed to provide more granularity
than legacy classful addressing; CIDR notation is expressed as /XX

Conclusion

IPv4 subnetting can be confusing at first, but we promise with practice it will become second nature.

Want more help learning subnetting? Check out these courses in our Members Section.

Frequently Asked Questions

Level Up in Cyber Security: Join Our Membership Today!

vip cta image
vip cta details
  • Nathan House

    Nathan House is the founder and CEO of StationX. He has over 25 years of experience in cyber security, where he has advised some of the largest companies in the world. Nathan is the author of the popular "The Complete Cyber Security Course", which has been taken by over half a million students in 195 countries. He is the winner of the AI "Cyber Security Educator of the Year 2020" award and finalist for Influencer of the year 2022.

  • Daniel says:

    Thank you!

  • WAK says:

    You should add RFC 1918 address space to this list

  • Waqas says:

    Thank you Sir.

  • Edwin says:

    Thank you!
    this is very useful.

  • Dai Son says:

    Thank you for sharing useful resources !

  • Alishia says:

    These subnetting masks are really useful for IPv4 addresses.

  • Thomas Kelly says:

    Love this – thank you!

  • Denzil says:

    Thank you very much Nathan. Appreciate that.

  • Will Pape says:

    Thank you! This is a very useful cheatsheet.

  • >