# Subnet Calculator (IPv4)

Subnetting?
 No of Hosts per Subnet: No of Subnets:

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 98.197.39.57. 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: