IPcalc is a subnet mask calculation tool including CIDR’s writing.

Installation

Before starting to use IPcalc, you need to know the IPv4 subnet mask notion and CIDR’s writing.
IPcalc will allow you to know the details of an IP from its subnet mask without having to calculate it :

CIDR   bits    Subnet mask     Number of hosts by sub array
/1  31  128.0.0.0       231-2 = 2147483646
/2  30  192.0.0.0       230-2 = 1073741822
/3  29  224.0.0.0       229-2 = 536870910
/4  28  240.0.0.0       228-2 = 268435454
/5  27  248.0.0.0       227-2 = 134217726
/6  26  252.0.0.0       226-2 = 67108862
/7  25  254.0.0.0       225-2 = 33554430
/8  24  255.0.0.0       224-2 = 16777214
/9  23  255.128.0.0         223-2 = 8388606
/10     22  255.192.0.0         222-2 = 4194302
/11     21  255.224.0.0         221-2 = 2097150
/12     20  255.240.0.0         220-2 = 1048574
/13     19  255.248.0.0         219-2 = 524286
/14     18  255.252.0.0         218-2 = 262142
/15     17  255.254.0.0         217-2 = 131070
/16     16  255.255.0.0         216-2 = 65534
/17     15  255.255.128.0       215-2 = 32766
/18     14  255.255.192.0       214-2 = 16382
/19     13  255.255.224.0       213-2 = 8190
/20     12  255.255.240.0       212-2 = 4094
/21     11  255.255.248.0       211-2 = 2046
/22     10  255.255.252.0       210-2 = 1022
/23     9   255.255.254.0       29-2 = 510
/24     8   255.255.255.0       28-2 = 254
/25     7   255.255.255.128     27-2 = 126
/26     6   255.255.255.192     26-2 = 62
/27     5   255.255.255.224     25-2 = 30
/28     4   255.255.255.240     24-2 = 14
/29     3   255.255.255.248     23-2 = 6
/30     2   255.255.255.252     22-2 = 2
/31     1   255.255.255.254     21=2
/32     0   255.255.255.255     20=1

The IPcalc installation is operated according to the following way on Linux :

sudo apt-get install ipcalc

On Mac OS, it is possible to install IPcalc through Brew (brew.sh) which is a package manager for OSX able to be used for other programs thereafter :

### Brew installation
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

### IPcalc installation via Brew
brew install ipcalc

Use

IPcalc is a relatively simple tool since it is enough to indicate the IP and its mask to get the result :

ipcalc 192.168.10.50/28
Address:   192.168.10.50        11000000.10101000.00001010.0011 0010
Netmask:   255.255.255.240 = 28  11111111.11111111.11111111.1111 0000
Wildcard:  0.0.0.15              00000000.00000000.00000000.0000 1111
=>
Network:   192.168.10.48/28      11000000.10101000.00001010.0011 0000
HostMin:   192.168.10.49         11000000.10101000.00001010.0011 0001
HostMax:   192.168.10.62         11000000.10101000.00001010.0011 1110
Broadcast: 192.168.10.63         11000000.10101000.00001010.0011 1111
Hosts/Net: 14                     Class C, Private Internet

ipcalc 192.168.10.50 255.255.255.240
Address:   192.168.10.50         11000000.10101000.00001010.0011 0010
Netmask:   255.255.255.240 = 28  11111111.11111111.11111111.1111 0000
Wildcard:  0.0.0.15              00000000.00000000.00000000.0000 1111
=>
Network:   192.168.10.48/28      11000000.10101000.00001010.0011 0000
HostMin:   192.168.10.49         11000000.10101000.00001010.0011 0001
HostMax:   192.168.10.62         11000000.10101000.00001010.0011 1110
Broadcast: 192.168.10.63         11000000.10101000.00001010.0011 1111
Hosts/Net: 14                     Class C, Private Internet

Searches can be done with different mask writings but also in subsearches while providing 2 masks :

### The following search :
ipcalc 192.168.10.50 /28 /30
### is equivalent to the following search :
192.168.10.50/28
192.168.10.48/30
192.168.10.52/30
192.168.10.56/30
192.168.10.60/30

Online IPcalc

The advantage of having IPcalc on your machine concerns your ability to get on hand information at any moment but the following script will help you to avoid an installation on your machine :