CIDR (Classless Inter-Domain Routing) is the Internet addressing scheme used to identify networks, and subnet masks, which divide large networks into smaller networks, are an integral part of CIDR.

In my daily work, sometimes I do need to find out all these but as I am not really a network guy therefore will need to find some easy ways to calculate all this information

In this blog post, we’ll look at how to calculate the subnet masks from CIDR. Let’s get started!

What is a subnet mask?

In IPv4, a subnet mask is a 32-bit number consisting of four octets (groups of eight bits) written in number form (e.g. The bits set to 1 in the mask indicate which part of the IP address is the network portion and which part is the host portion.

For instance, if an IP address is and the subnet mask is, then the first three octets (192.168.1) represent the network portion, while the final octet (1) represents the host portion. This means that any device with an IP address in the range of to belongs to the same network.

Subnetting allows multiple networks to be created within a larger network, improving its performance and security.

How to calculate a subnet mask from CIDR notation?

In order to calculate a subnet mask from CIDR notation, follow these steps:

  1. Convert the CIDR notation to a subnet mask in binary form:
    • For example, for a CIDR notation of /24, the binary equivalent would be 11111111.11111111.11111111.00000000.
  2. Convert the binary subnet mask to IPv4 format:
    • Translate the binary representation 11111111.11111111.11111111.00000000 to its IPv4 format equivalent of This subnet mask in decimal form is

In binary, 11111111 refers to 255 and 00000000 refers to 0.

Table for CIDR Notation to Subnet Mask (Cheat Sheet)

Alternatively, you can refer the a full table for converting CIDR notation to subnet mask:

CIDR NotationSubnet Mask

CIDR notation is used to indicate how many bits of an IP address are used for the network portion.

This is done by setting the corresponding number of bits to 1 in the subnet mask. Hence, the subnet mask determines which portion of the IP address is used for the network and which portion is used for the host.

How To calculate subnet masks correctly – Using Network Subnet Calculator

Maybe the easiest, fastest, and more accurate way will be using the network subnet calculator to help you get the info you needed.

I actually used ChatGPT to come out with a simple web calculator for subnet:

For example, I need to find out information about the subnet mask and other info for I can just simply input this in and hit the Calculate button

Network Subnet Calculator

It will be based on the IP address given and provide me the information like the subnet mask which is and other useful information like the broadcast address, number of hosts, and first and last host IP.

How To calculate subnet masks correctly - Using Network Subnet Calculator


In this blog post, I have briefly shared d how to calculate subnet masks from CIDR easily using the calculator.

Also, provide you with more info about network subnetting and a full table for you to reference based on CIDR notation and subnet masks.

I hope you found the information helpful. If you have any questions or want more information about specific products, please leave a comment below – I look forward to hearing from you!

Categorized in: