skip to content

System: Calculating Subnets

 Tweet Share0 Tweets

Subnet and Network masks (Netmasks) are used for all sorts of tasks from firewalls to networking. It can be a time-consuming process to work out the appropriate netmask and subnet mask for different IP addresses. The form below makes it simple.

Netmask and Subnet Calculator

Enter two valid (and different) IPv4 addresses in the form below. It will calculate the most specific netmask and subnet mask that cover both addresses. If you have a range of IP address that appear to be from the same subnet, enter the lowest and highest for best results:

e.g. 86.59.118.144 e.g. 86.59.118.159

You can also paste an ip range ("A.B.C.D - E.F.G.H") into either field and it will be separated into a start and end address. Thanks to Andrew for the suggestion.

The calculated subnet mask will appear in the section below.

Netmask and subnet mask

The table below displays the two IP addresses you entered in binary format so you can see how they compare:

1st address01010110 00111011 01110110 10010000 (86.59.118.144)
2nd address01010110 00111011 01110110 10011111 (86.59.118.159)
Netmask255.255.255.240
Subnet mask86.59.118.144/28 (16 addresses)

The netmask indicates the number of bits that they have in common starting from the high (left) end.

The subnet mask defines the smallest subnet that contains both addresses. It's used mostly in network administration or when specifying ip address ranges to block using iptables (firewall).

References

< System

Send a message to The Art of Web:


used only for us to reply, and to display your gravatar.

<- copy the digits from the image into this box

press <Esc> or click outside this box to close

User Comments

Post your comment or question

3 January, 2016

Thanks for this tool, incredibly useful but its been difficult to find one which can accept two IP's and work out the subnet mask (for iptables for example).

2 September, 2014

Nice tool. Thanks for writing it. It would be nicer if I could just plop in something like:218.2.0.0 - 218.4.255.255
instead of having to edit it and place it squarely in the provided boxes. That's the output returned by whois.

Thank you

The form supports that now

top