This calculator allows users to input an IPv4 address and subnet mask to compute detailed subnetting information. It provides a comprehensive breakdown of subnet-related properties and includes a feature to convert the IP and mask into different formats, including dotted-decimal, hexadecimal, binary, and decimal. Additionally, it offers a subnetting function, also known as Subnet Segmentation, which allows users to browse host bits and perform subnet segmentation.
IPv4 Subnet Calculator
Share if you like:
IPv4 Subnet Mask Cheat Sheet
Download
A Subnet Mask Cheat Sheet mapping IPv4 subnet masks from CIDR notation to their dotted decimal equivalents, including subnet prefix length (CIDR Notation), wildcard masks, and total usable host counts. The subnet prefix length represents the number of leading bits used for the network portion in CIDR notation. This subnetting cheat sheet serves as a quick reference for network engineers and IT professionals. You can download it anytime if needed!
CIDR Notation
Dotted Decimal
Wildcard Mask
Total Hosts Description
Total Hosts
Usable Hosts
Subnet Description
/32
255.255.255.255
0.0.0.0
how many ips in a /32
1
1 (Host only)
/32 subnet
/31
255.255.255.254
0.0.0.1
how many ips in a /31
2
2 (Point-to-Point)
/31 subnet
/30
255.255.255.252
0.0.0.3
how many ips in a /30
4
2
/30 subnet
/29
255.255.255.248
0.0.0.7
how many ips in a /29
8
6
/29 subnet
/28
255.255.255.240
0.0.0.15
how many ips in a /28
16
14
/28 subnet
/27
255.255.255.224
0.0.0.31
how many ips in a /27
32
30
/27 subnet
/26
255.255.255.192
0.0.0.63
how many ips in a /26
64
62
/26 subnet
/25
255.255.255.128
0.0.0.127
how many ips in a /25
128
126
/25 subnet
/24
255.255.255.0
0.0.0.255
how many ips in a /24
256
254
/24 subnet
/23
255.255.254.0
0.0.1.255
how many ips in a /23
512
510
/23 subnet
/22
255.255.252.0
0.0.3.255
how many ips in a /22
1024
1022
/22 subnet
/21
255.255.248.0
0.0.7.255
how many ips in a /21
2048
2046
/21 subnet
/20
255.255.240.0
0.0.15.255
how many ips in a /20
4096
4094
/20 subnet
/19
255.255.224.0
0.0.31.255
how many ips in a /19
8192
8190
/19 subnet
/18
255.255.192.0
0.0.63.255
how many ips in a /18
16384
16382
/18 subnet
/17
255.255.128.0
0.0.127.255
how many ips in a /17
32768
32766
/17 subnet
/16
255.255.0.0
0.0.255.255
how many ips in a /16
65536
65534
/16 subnet
/15
255.254.0.0
0.1.255.255
how many ips in a /15
131072
131070
/15 subnet
/14
255.252.0.0
0.3.255.255
how many ips in a /14
262144
262142
/14 subnet
/13
255.248.0.0
0.7.255.255
how many ips in a /13
524288
524286
/13 subnet
/12
255.240.0.0
0.15.255.255
how many ips in a /12
1048576
1048574
/12 subnet
/11
255.224.0.0
0.31.255.255
how many ips in a /11
2097152
2097150
/11 subnet
/10
255.192.0.0
0.63.255.255
how many ips in a /10
4194304
4194302
/10 subnet
/9
255.128.0.0
0.127.255.255
how many ips in a /9
8388608
8388606
/9 subnet
/8
255.0.0.0
0.255.255.255
how many ips in a /8
16777216
16777214
/8 subnet
/7
254.0.0.0
1.255.255.255
how many ips in a /7
33554432
33554430
/7 subnet
/6
252.0.0.0
3.255.255.255
how many ips in a /6
67108864
67108862
/6 subnet
/5
248.0.0.0
7.255.255.255
how many ips in a /5
134217728
134217726
/5 subnet
/4
240.0.0.0
15.255.255.255
how many ips in a /4
268435456
268435454
/4 subnet
/3
224.0.0.0
31.255.255.255
how many ips in a /3
536870912
536870910
/3 subnet
/2
192.0.0.0
63.255.255.255
how many ips in a /2
1073741824
1073741822
/2 subnet
/1
128.0.0.0
127.255.255.255
how many ips in a /1
2147483648
2147483646
/1 subnet
/0
0.0.0.0
255.255.255.255
how many ips in a /0
4294967296
4294967294
/0 subnet
Frequently Asked Questions
What is a Subnet Mask?
How to Calculate Subnet Mask?
What’s the difference between Class A, Class B, and Class C networks?
Does a /31 or /32 subnet really have no usable IP addresses?
How do I quickly calculate how many subnets and hosts I can get from a given subnet mask?
What is the difference between private and public IPv4 addresses?
What’s the easiest way to remember subnet masks and their binary forms?
A subnet mask is a 32-bit number that divides an IPv4 address into a network and host portion. It helps determine which part of the address identifies the network and which part identifies devices (hosts) within that network.
An IPv4 address is a 32-bit binary number, usually written in dotted decimal notation (e.g., 192.168.1.10). A subnet mask works by masking part of this address to define the network.
For example:
IP Address: 192.168.1.10
Subnet Mask: 255.255.255.0
In binary:
IP Address: 11000000.10101000.00000001.00001010
Subnet Mask:11111111.11111111.11111111.00000000
how to determine subnet mask
how to calculate subnet
When we talk about subnet masks in IPv4 networking, we’re essentially discussing how to separate the network portion from the host portion of an IP address. Below is a straightforward approach to understanding and calculating a subnet mask based on your needs.
Determine Host Requirements: Use the formula 2^n - 2 ≥ (required number of hosts) to find the minimum number of host bits (n).
Find the CIDR Prefix: Subtract n from 32 (for IPv4) to get the number of network bits. This yields the CIDR notation (e.g., /26).
Construct the Mask: Create a 32-bit binary number with the first (32 - n) bits set to 1 and the remaining n bits set to 0. Convert this binary number into dotted-decimal format.
Example: Network for 700 Hosts
Step 1: Calculate Minimum Host Bits Using the formula 2^n - 2 ≥ 700, we find that 210 = 1024 is the smallest power of 2 that meets this requirement. Therefore, we need 10 host bits.
Step 2: Find the CIDR Prefix Subtract the 10 host bits from 32: 32 - 10 = 22. The CIDR notation for this network is /22.
Step 3: Construct the Subnet Mask The first 22 bits are set to 1, and the remaining 10 bits are set to 0. In binary, this is: 11111111.11111111.11111100.00000000 Converted to dotted-decimal format, the subnet mask is 255.255.252.0.
Historically, IP addresses were categorized into classes based on their first octet:
Class A: First octet range 0–127 (e.g., 10.0.0.0) with a default mask of 255.0.0.0 (/8).
Class B: First octet range 128–191 (e.g., 172.16.0.0) with a default mask of 255.255.0.0 (/16).
Class C: First octet range 192–223 (e.g., 192.168.0.0) with a default mask of 255.255.255.0 (/24).
However, classful networking is mostly outdated. Modern networks rely on CIDR (Classless Inter-Domain Routing), where the subnet mask is determined by the prefix length (e.g., /24, /20) rather than strictly adhering to Class A, B, or C.
A common mistake is assuming that a /24 must be Class C or that you cannot assign a /24 to addresses that traditionally fall in the Class A or B range. With CIDR, the address range and the subnet mask are independent of the old class definitions.
While classful networking is obsolete, Class A, B, and C are still referenced out of habit and for simplicity when describing different network sizes:
Class A → Large networks
Class B → Medium-sized networks
Class C → Small networks
Additionally, many educational resources still teach classful networking to provide a foundational understanding of IP addressing. It helps beginners learn basic subnetting before transitioning to CIDR-based subnetting.
Key Takeaway: Although CIDR is now the standard, network engineers still use Class A, B, and C as shorthand for network sizes, making communication easier.
Commonly, people believe a /31 or /32 offers no usable hosts in a traditional sense because:
/31: Would normally have 2 IPs (one network address and one broadcast).
/32: Would logically have just 1 IP, often considered a host route or loopback.
However, /31 addresses can be used for point-to-point links(RFC 3021), effectively allowing both IPs to be assigned to the two endpoints.
/32 addresses are frequently used for loopback interfaces, router IDs, or point-to-multipoint links in specific setups (e.g., OSPF, BGP). So while they don’t offer traditional “host ranges,” they are still very much usable in routing scenarios.
Number of subnets: Count how many bits you borrowed from the host portion to create subnets. If you borrowed n bits from the default mask, then the number of subnets is 2ⁿ.
Number of hosts per subnet: Count how many bits remain in the host portion. If you have h bits left for hosts, the total IP addresses in that subnet is 2ʰ, and the usable hosts (traditionally) is 2ʰ - 2 (subtracting network and broadcast addresses).
In modern contexts (especially with /31 and /32 in specialized scenarios), remember that the "usable host formula" can change. But for typical subnets, 2ʰ - 2 is still a solid rule.
Private addresses: These are reserved for internal networks and are not routable on the public internet. Common private ranges are:
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
Public addresses: These are globally unique and are routable on the internet.
Most organizations use private addresses internally and rely on NAT (Network Address Translation)to provide internet access for internal devices.
Memorize the common dotted-decimal to CIDR conversions:
255.0.0.0 = /8
255.255.0.0 = /16
255.255.255.0 = /24
255.255.255.128 = /25, etc.
Use quick binary math:
0 = 00000000 (0 bit)
128 = 10000000 (1 bit)
192 = 11000000 (2 bits)
224 = 11100000 (3 bits)
240 = 11110000 (4 bits)
248 = 11111000 (5 bits)
252 = 11111100 (6 bits)
254 = 11111110 (7 bits)
Practice with a cheat sheet or use a subnet calculator until these mappings become second nature.
What is a Subnet Mask?
How to Calculate Subnet Mask?
What’s the difference between Class A, Class B, and Class C networks?
Does a /31 or /32 subnet really have no usable IP addresses?
How do I quickly calculate how many subnets and hosts I can get from a given subnet mask?
What is the difference between private and public IPv4 addresses?
What’s the easiest way to remember subnet masks and their binary forms?