CIDR IP Converter Tools

An IP (Internet Protocol) address is a string of numbers that are separated by dots to identify different elements in a network.

There are two versions of IP addresses based on the number of bits they use, which are IPv4 and IPv6 addresses. An IPv4 consists of 32 bits separated by a dot indicating every octet (8-bits). Because of the growth of the number of devices on the internet the IPv6 version was introduced back in 1995 and is still under deployment in various networks today. The IPv6 address consists of 128 bits which are separated by a colon indicating every hexadecimal (16-bits).

IP addresses are written in a human-readable manner like 192.168.10.1 represents an IPv4 address whereas 2001:db8:0:1234:0:345:6:1 represents an IPv6 address.

Here we shall be discussing the IPv4 networks and how they are used in a network using its subnet. Before we subnet we should know that the IP space is managed by IANA (Internet Assigned Numbers Authority) that conserves Private and Public IP addresses.

The Private IP Network addresses are commonly used for intranet, i.e. communication within a network. The Private IP networks can be used repeatedly in different networks. While on the other hand the Pubic IP Networks are used for communication of networks over the internet, meaning these IPs need to be unique.

Depending on how many devices are connected in a Private IP network, IANA has further defined different classes, among which the common classes are given below:

Class Private IP Range Subnet Mask No. of IP Addresses
A 10.0.0.0 – 10.255.255.255 255.0.0.0 16,777,216
B 172.16.0.0 – 172.16.31.255 255.255.0.0 1,048,576
C 192.168.0.0 – 192.168.255.255 255.255.255.0 65,536

To efficiently make use of an IP Network we further subnet our chosen or assigned network.

   

How to convert a CIDR to IP Address

CIDR stands for Classless Inter-Domain Routing also commonly known as super-netting. The CIDR notation is a presentation of an IP address along with its associated routing prefix. The decimal after the slash denotes the number of ones in its subnet.

Examples are:

  • 110.40.240.16/22
  • 14.12.72.8/17
  • 10.98.1.64/28

Now let’s convert the above CIDR notations to IP Addresses and its respective subnet addresses.

   

How to convert an IP to Binary notation?

An IP address is a presentation of 32 bits in the form of 4 octets separated by a dot. Let’s convert 110.40.240.16 to binary, to do this we shall be concerting each octet to binary as shown below:

IP Address 110. 40. 240. 16
In Binary 01101110. 00101000. 11110000. 00010000
   

Similarly let’s convert 14.12.72.8 to binary:

IP Address 14. 12. 72. 8
In Binary 00001110. 00001100. 01001000. 00001000
   

Similarly let’s convert 10.98.1.64 to binary:

IP Address 10. 98. 1. 64
In Binary 00001010. 01100010. 00000001. 01000000
   

How to find Subnet, Network Address, Broadcast Address, Number of IPs and Network Ranges in a Subnet from a CIDR notation?

Now let’s find the Subnet, Network Address and Broadcast Address from a CIDR notation. For Example, let final all these for 110.40.240.16/22

In the CIDR notation the decimals after the slash i.e. 22 means 22 bits for the subnet. At 8 bits per byte you get 16 for the first two bytes, and six for the third octet while remaining bits remain zero. It means your last two octets will be of the form (nnnn nnhh. hhhh hhhh), where n is a subnet bit and h a host bit. Thus we have:

IP Address: 		110.40.240.16
In Binary:		01101110. 00101000. 111100|00.00010000
Subnet Mask in bits:	11111111. 11111111. 111111|00.00000000

Where Blue highlighted are the network bits (n) and Yellow highlighted are the host bits (h).
To find the subnet mask we shall convert the subnet mask in bits to octets as shown below:

Subnet Mask (in bits):	11111111. 11111111. 11111100.00000000
Subnet Mask:		255.255.252.0 (Subnet Mask)

Now to find the network ID convert all the host bits of the IP address to ‘0’, that gives us the Network Address:

In Binary:		01101110. 00101000. 111100|00.00000000
IP Address:		110.40.240.0 (Network Address)

To find broadcast ID convert all the host bits of the IP address to ‘1’, that gives us the Broadcast Address:

In Binary:		01101110. 00101000. 111100|11.11111111
IP Address:		110.40.243.255 (Broadcast Address)

To find the number of IPs Addresses in a subnet should know the number of host bits which are 10 in this case:

No. of IP Addresses: 2No. of Hosts-bits = 210 = 1024 IP Address

Here the Usable IPs are 2 less, these IPs are used as Network Address and Broadcast Address. i.e.

Usable IP Addresses: 2No. of Hosts-bits-2 = 210-2 = 1024-2 = 1022 Usable IP Address

The Network Range is: 110.40.240.1 - 110.40.243.254, these are the usable 1022 IPs between the Network Address till the Broadcast Address.

   

Similarly let’s take the example of 14.12.72.8/17

In the CIDR notation the decimals after the slash i.e. 17 means 17 bits for the subnet. At 8 bits per byte you get 16 for the first two bytes, and one for the third octet while remaining bits remain zero. It means your last two octets will be of the form (nhhh hhhh. hhhh hhhh), where n is a subnet bit and h a host bit. Thus we have:

IP Address: 		14.12.72.8
In Binary:		00001110. 00001100. 0|1001000.00001000
Subnet Mask in bits:	11111111. 11111111. 1|0000000.00000000

Where Blue highlighted are the network bits (n) and Yellow highlighted are the host bits (h).
To find the subnet mask we shall convert the subnet mask in bits to octets as shown below:

Subnet Mask (in bits):	11111111. 11111111. 10000000.00000000
Subnet Mask:		255.255.128.0 (Subnet Mask)

Now to find the network ID convert all the host bits of the IP address to ‘0’, that gives us the Network Address:

In Binary:		00001110. 00001100. 0|0000000.00000000     
IP Address:		14.12.0.0 (Network Address)

To find broadcast ID convert all the host bits of the IP address to ‘1’, that gives us the Broadcast Address:

In Binary:		00001110. 00001100. 0|1111111.11111111 
IP Address:		14.12.127.255 (Broadcast Address)

Similarly, as in previous example, to find the number of IPs Addresses in a subnet should know the number of host bits which are 15 in this case:

No. of IP Addresses: 2No. of Hosts-bits = 215 = 32768 IP Address

Here the Usable IPs are 2 less, these IPs are used as Network Address and Broadcast Address. i.e.

Usable IP Addresses: 2No. of Hosts-bits-2 = 215-2 = 32768-2 = 32766 Usable IP Address

The Network Range is: 14.12.0.1 - 14.12.127.254, these are the 32766 usable IPs between the Network Address till the Broadcast Address.

   

Finally let’s take the example of 10.98.1.64/28

In the CIDR notation the decimals after the slash i.e. 28 means 28 bits for the subnet. At 8 bits per byte you get 24 for the first three bytes, and four for the last octet while remaining bits remain zero. It means your last (4th) octets will be of the form (. nnnn hhhh), where n is a subnet bit and h a host bit. Thus we have:

IP Address: 		10.98.1.64
In Binary:		00001010. 01100010. 00000001.0100|0000
Subnet Mask in bits:	11111111. 11111111. 11111111.1111|0000

Where Blue highlighted are the network bits (n) and Yellow highlighted are the host bits (h).
To find the subnet mask we shall convert the subnet mask in bits to octets as shown below:

Subnet Mask (in bits):	11111111. 11111111. 11111111.11110000
Subnet Mask:		255.255.255.240 (Subnet Mask)

Now to find the network ID convert all the host bits of the IP address to ‘0’, that gives us the Network Address:

In Binary:		00001010. 01100010. 00000001.0100|0000     
IP Address:		10.98.1.64 (Network Address)

To find broadcast ID convert all the host bits of the IP address to ‘1’, that gives us the Broadcast Address:

In Binary:		00001010. 01100010. 00000001.0100|1111 
IP Address:		10.98.1.79 (Broadcast Address)

Similarly, as in previous example, to find the number of IPs Addresses in a subnet should know the number of host bits which are 4 in this case:

No. of IP Addresses: 2No. of Hosts-bits = 24 = 16 IP Address

Here the Usable IPs are 2 less, these IPs are used as Network Address and Broadcast Address. i.e.

Usable IP Addresses: 2No. of Hosts-bits-2 = 24-2 = 16-2 = 14 Usable IP Address

The Network Range is: 10.98.1.65 - 10.98.1.78, these are the 14 usable IPs between the Network Address till the Broadcast Address.

   

Allocating subnets from a Block

We have a new IP block of address starting with the address 139.145.56.0/22. We shall be calculating the total number of addresses available in this block including all the special addresses.

Further we will distribute the available addresses into further subnets (meaning not allocating more than you have to), with 4 new subnets determined as follows:

  • Network A needs 65 usable IP addresses
  • Network B needs 100 usable IP addresses
  • Network C needs 33 usable IP addresses, and
  • Network D needs 13 usable IP addresses
 

Currently we have the 139.145.56.0/22 block of network which can be written as:

IP Address: 		139.145.56.0
In Binary:		10001011. 10010001. 001110|00.00000000
Subnet Mask in bits:	11111111. 11111111. 111111|00.00000000

The subnet denotes we have 10 host bits (highlighted in yellow). Now to accommodate every sub-network we shall convert the require addresses into bits to determine how many host bits it will require to accommodate the required addresses.

 

For Network-A 65 IP addresses are required

Network A Addresses Required 65
In Binary 01000001
Bits used as Host 7

This means we shall require the block:

Network Address:	139.145.56.0
In Binary:		10001011. 10010001. 00111000.0|0000000
Subnet Mask in bits:	11111111. 11111111. 11111111.1|0000000 (7-bits conserved for host)
Subnet: 		255.255.255.128

To determine the broadcast address, we shall select the assigned IP Address and convert all the host bits to 1’s, as shown below:

In Binary:		10001011. 10010001. 00111000.0|1111111
Broadcast IP Address: 	139.145.56.127

Thus we shall be using 139.145.56.0/25 for Network A where usable IP range is 139.145.56.1 to 139.145.56.126:

Sub-Network Network address Broadcast address Subnet CIDR
Network-A 139.145.56.0 139.145.56.127 255.255.255.128 139.145.56.0/25
   

For Network-B 100 IP addresses are required

Network B Addresses Required 100
In Binary 01100100
Bits used as Host 7

We shall start after the broadcast address of the previous network, as shown below:

Network Address:	139.145.56.128
In Binary:		10001011. 10010001. 00111000.1|0000000
Subnet Mask in bits:	11111111. 11111111. 11111111.1|0000000 (7-bits conserved for host)
Subnet: 		255.255.255.128

To determine the broadcast address, we shall select the assigned IP Address and convert all the host bits to 1’s, as shown below:

In Binary:		10001011. 10010001. 00111000.1|1111111
Broadcast IP Address: 	139.145.56.255

Thus we shall be using 139.145.56.128/25 for Network B where usable IP range is 139.145.56.129 to 139.145.56.254:

Sub-Network Network address Broadcast address Subnet CIDR
Network-B 139.145.56.128 139.145.56.255 255.255.255.128 139.145.56.128/25
   

For Network-C 33 IP addresses are required

Network C Addresses Required 33
In Binary 00100001
Bits used as Host 6

We shall start after the broadcast address of the previous network, as shown below:

IP Address: 		139.145.57.0
In Binary:		10001011. 10010001. 00111001.00|000000
Subnet Mask in bits:	11111111. 11111111. 11111111.11|000000 (6-bits conserved for host)
Subnet: 		255.255.255.192

To determine the broadcast address, we shall select the assigned IP Address and convert all the host bits to 1’s, as shown below:

In Binary:		10001011. 10010001. 00111001.00|111111
Broadcast IP Address: 	139.145.57.63

Thus we shall be using 139.145.57.0/26 for Network C where usable IP range is 139.145.57.1 to 139.145.57.62:

Sub-Network Network address Broadcast address Subnet CIDR
Network-C 139.145.57.0 139.145.57.63 255.255.255.192 139.145.57.0/26
   

For Network-D 13 IP addresses are required

Network D Addresses Required 13
In Binary 00001101
Bits used as Host 4

We shall start after the broadcast address of the previous network, as shown below:

IP Address: 		139.145.57.64
In Binary:		10001011. 10010001. 00111001.0000|0000
Subnet Mask in bits:	11111111. 11111111. 11111111.1111|0000 (4-bits conserved for host)
Subnet: 		255.255.255.240

To determine the broadcast address, we shall select the assigned IP Address and convert all the host bits to 1’s, as shown below:

In Binary:		10001011. 10010001. 00111001.0000|1111
Broadcast IP Address: 	139.145.57.79

Thus we shall be using 139.145.57.64/28 for Network D where usable IP range is 139.145.57.65 to 139.145.57.78:

Sub-Network Network address Broadcast address Subnet CIDR
Network-D 139.145.57.64 139.145.57.79 255.255.255.240 139.145.57.64/28

If you have questions or comments feel free to contact me or leave a comment below

Leave a comment

Your IP Address is

13.59.92.247

Choose the tool and run the magic!

GUIDES

NewTutorial: convert IP to binary and decimal

How to SNMPWALK a device

NMAP - how to find open ports

NMAP - convert output XML to CSV

Convert CIDR manually in binary