>
Calculators.Solutions ⬇︎ Click to open the menus
Simple online calculators
Found a bug? Have a suggestion? Contact me
Loading the template
Calculators Solutions : Subnet mask converter
Dotted decimal ↴
Binary ↴
CIDR ↴

Number of available addresses ↴
Check ↴

Results history (All cells are editable)
Dotted decimal Binary CIDR Number of addresses Check Note
{y}
Please wait a moment

Convert a Subnet Mask

This converter transforms a subnet mask in dotted decimal notation (for example, "255.255.255.0") into its binary equivalent (for example, "11111111.11111111.11111111.00000000") and back. It also calculates the corresponding CIDR prefix (for example, "/24").

In addition to the conversion, it calculates the number of addresses available in the subnet, which is essential for network planning.

How does the converter work?

The converter takes as input a subnet mask expressed in one of the standard notations (dotted decimal, binary or CIDR). From this value, it automatically calculates the corresponding representations in the other formats.

Validation and error handling

The converter includes input validation to make sure the entered values are valid. If an error is detected, an error message is displayed.

What is a subnet mask?

An IP address is divided into two parts: the network part and the host part. The subnet mask determines the boundary between these two segments, indicating which bits correspond to the network identifier and which to the host identifier.

Structure of a subnet mask

Just like an IP address, the subnet mask is made up of 4 octets and is therefore encoded in 32 bits (4 octets * 8 bits).

The bits must be contiguous. In other words, there must be a run of 1s on the left and a run of 0s on the right. Mixing 0s and 1s is forbidden and illogical for a subnet mask.

For example, 255.255.128.0 is a valid subnet mask.

Using a subnet mask

A subnet mask is always associated with an IP address.

For example: 194.250.0.5 with a subnet mask of 255.255.224.0. The mask lets us identify the network part and the host part. In this case with the IP address 194.250.0.5 = 11000010.11111010.00000000.00000101 and the mask 255.255.224.0 = 11111111.11111111.11100000.00000000, we discover the network part (underlined) and the host part: 11000010.11111010.00000000.00000101!

CIDR mask notation

There is a very quick method for identifying the subnet mask: the CIDR notation. Since the bits are contiguous and the subnet mask is encoded in 32 bits, if we know the number of 1s, we necessarily know the number of 0s. So with this method, instead of writing 194.250.0.5/255.255.128.0, we write 194.250.0.5/25. The number 25 corresponds to the number of 1s in the binary subnet mask of the example.

Number of available addresses

The total number of addresses in a subnet depends on the number of bits reserved for the host part, i.e. the number of zeros in the mask. The formula used is: 2number of host bits.

In the previous example (/25), there are 7 bits for the host part. This gives 27 = 128 addresses in total. But in IPv4, two addresses are generally reserved (network address and broadcast address), which leaves 126 usable addresses.

Keyboard shortcuts

m ⇝ Clear

f ⇝ Save

Saving and results history

You can save your results by clicking the SAVE button. The results are stored in the history, accessible at the bottom of the page and exportable in CSV or PDF format.