Subnet Calculator (IPv4)
This subnet calculator provides the details of an IPv4 network and calculates subnets of the network. To use the calculator, please provide one IP address of the network, select its CIDR notation, and click the "Calculate" button. When calculating the subnets, the options of "Subnet Mask", "No. of Hosts per Subnet", and "No. of Subnets" are corelated. Simply select the one value that you are most concerned with, and the other two values will be populated automatically.
What is a subnet?
A subnet, short for "subnetwork," is the subdivision of an IP network. The practice of logically dividing an IP network into two or more subnets is referred to as "subnetting." The purpose of subnetting is to make networks more efficient by allowing network traffic to more directly travel to its destination, reducing overall network traffic.
Any device that connects to the internet has a unique Internet Protocol (IP) address that ensures that data sent over the Internet reaches the correct device. IPv4 (Internet Protocol version 4), the subject of this calculator, is the 4th version of the Internet Protocol, which is the Internet's set of rules for communication that directs most of today's Internet traffic. An IPv4 address takes the form of decimal numbers separated by periods, such as 184.108.40.206. This address represents 32-bit integers, where each set of digits separated by periods can range from 0 to 255. The first part of an IP address indicates the network that the address belongs to, while the second part indicates the specific device within the given network. Furthermore, networks are classified into different classes, A through E, where Class A networks can connect millions of devices, while each successive class connects fewer devices. In the IP address above, the 98 the network, and everything after it, the 197.39.57, indicates the device. This differs for Class B, C, and other networks, but will not be detailed here.
Based on the above, it is relatively easy for Internet routers to identify the appropriate network to direct data to. However, since networks, such as Class A networks, may contain millions of devices, it can take a significant amount of time to route data to the appropriate device. For this reason, networks are divided into subnets such that devices can be part of various subnets, making the process of routing data to the appropriate device more efficient. This is done through subnet masks, which allow routers within a network to sort data into the appropriate subnets.
What is a subnet mask?
A subnet mask is similar to an IP address, but it is used only within a network. It is written in the same form of decimal numbers separated by a period. 255.255.255.0, or /24, is an example of a subnet mask. As mentioned above, an IP address is made up of two parts: the network ID and the host ID. A subnet divides the host ID into a subnet ID and the host ID, and a subnet mask determines how the IP address is divided into its network and host parts. In other words, a subnet mask tells us which part of a given IP address, such as 192.168.123.212, belongs to the network, and which part belongs to the host, or given device. The subnet mask does not actually contain the network or host portion of an IP address, it simply tells the computer where to look for these portions in the given address
For example, given the IP address 192.168.123.212 and the subnet mask 255.255.255.0 (/24), the address and subnet mask can be converted to binary as follows:
IP address: 11000000.10101000.01111011.11010100
Subnet mask: 11111111.11111111.11111111.00000000
The 1s in the subnet mask represent the network portion of the IP address, and the 0s represent the host portion. Thus, lining the two above up, the network portion of the IP address is 11000000.10101000.01111011, and the host portion is 11010100. Converting back from binary, the network ID is 192.168.123.0 and the host ID is 000.000.000.212.
Classless Inter-Domain Routing (CIDR) notation is a compact representation of a subnet mask. It takes the form of a decimal number that follows a slash (/) after an IP address. For example, in the IP address 220.127.116.11/24, the /24 represents the subnet in CIDR notation. Recall that an IP address written in the preceding form (the decimal numbers before the /) represents a 32-bit number. The /24 also represents the 32-bit subnet mask. Specifically, the /24 is the count of consecutive 1-bits from left to right in the subnet mask, meaning that there are 24 1-bits. For example, the subnet mask /24 is written in decimal form as 255.255.255.0 or 11111111.11111111.11111111.00000000. Note that there are 24 consecutive 1-bits preceding the 8 0s that make up the 32-bit subnet mask. Rather than needing to write either of these, both of which can be tedious, CIDR notation compacts the subnet mask into "/24."
As another example, the subnet mask 255.255.255.224, or 11111111.11111111.11111111.11100000, is indicated in CIDR notation as /27. In cases where many subnet masks are being discussed, CIDR notation significantly simplifies the process of referencing different subnet masks.