# Classes in IP address: IPv4 Classes

A hierarchical IP address or IPv4 contains various classes in its address. IPv4 is 32 bits binary numbers. IP address assignment on the network entirely depends on Internet Corporation for Assigned Names and Numbers (ICANN). Based on the requirement of hosts per network, Internet Protocol version 4 or IPv4 is broken into five classes and these classes can be easily identified by the first octet of IP address.

1. Class A
2. Class B
3. Class C
4. Class D
5. Class E

Note: All these classes of IP addresses can be identified by the first octet of the address.

Index

## How to find the Network and Host number in an IP address?

You can use the below formula to find the total number of networks and Host per class in an IP address. • Number of Networks: 2Network bits
• Number of Host per Network: 2Host bits-2

When calculating the number of hosts per network, two IPs are always subtracted from the total IPs because the first IP of a network is always reserved for the network number and the last IP is reserved for Broadcast IP. Refer above formula to find the number of Host per Network (2Host bits-2).

## Class A: IPv4 Address classes

The first bit of the first octet is set to zero (0), and this first octet or first dotted-decimal represents the Network part of this address. The First octet ranges from 1-127 or 00000000-01111111. Excluding the first octet or first dotted-decimal part, the remaining will be the Host part of this address.

Example: 2.134.213.2

Note: Class “A” IP address ranges between 1 to 126 only, because IP 127 is reserved for Loopback address.

• Number of possible Networks in Class A = 28-1= 27 = 127
• Number of Hosts in class A (2Host bits-2) = 224-2= 16777214
• The default subnet mask for class A = 255.0.0.0
• IP format for class A = 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

## Class B: IPv4 Address classes

The first bit is set to 1 and the second bit set to 0, and the first 16 bits or the first two dotted-decimal represents the Network part of the address. Further, the remaining part would be the Host of the address. Example: 135.57.33.17

Note: Class “B” IP address ranges between 128.0.0.0 to 191.255.0.0 and 2 bits are reserved for Loopback address.

• Hence, the Number of possible Networks in class B = 214=16384
• Number of Hosts per network in class B = 216-2-2 = 65534
• The default subnet mask for class B = 255.255.0.0
• IP format for class B = 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

## Class C: IPv4 Address classes

The first two bits set to 1 and the third bit set to 0 which means the first 24 bits are the network part of the IP address and the remaining will be the Host. Example: 192.168.178.1

Note: Class “C” IP addresses range between 192.0.0.0 to 223.255.255.0 and 3 bits are reserved for Loopback address.

• Hence, the Number of possible Networks in Class “C”= 224-3= 221= 2097152
• Number of Hosts per network in class C = 28-2 = 254
• The default subnet mask for class C = 255.255.255.0
• IP format for class C = 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

## Class D: IPv4 Address Classes

Unlike Class A, B, and C, Class D addresses are not used for normal networking operations. Class D IP addresses are used for Multicasting applications.

The first three bits are set to 1 and the fourth bit set to 0. All 32 bits are reserved for the Network part and used for multicasting applications.

Example: 227.21.5.173

Note: Class D IP addresses ranges between 224.0.0.0 to 239.255.255.255. It is reserved for Multicasting data hence; it doesn’t require any Host in their addressing. Further, Class D addresses don’t have any subnet mask.

## Class E: IPv4 Address classes

The uses of Class E addresses are reserved for Study or Research and Development purposes. In this class, the first four network bits are set to 1 hence; it ranges between 240.0.0.0 to 255.255.255.255.

Example: 243.163.89.27

Similar to the Class D address, Class E also doesn’t have any subnet mask.

## Bit-wise representation in IP address classes

Class A: (0.0.0.0 – 127.255.255.255)

• 0. 0. 0 = 00000000.00000000.00000000.00000000
• 127.255.255.255 = 01111111.11111111.11111111.11111111

Class B: (128. 0. 0. 0 – 191.255.255.255)

• 128. 0. 0. 0 = 10000000.00000000.00000000.00000000
• 191.255.255.255 = 10111111.11111111.11111111.11111111

Class C: (192. 0. 0. 0 – 223.255.255.255)

• 192. 0. 0. 0 = 11000000.00000000.00000000.00000000
• 223.255.255.255 = 11011111.11111111.11111111.11111111

Class D: (224. 0. 0. 0 – 239.255.255.255)

• 224. 0. 0. 0 = 11100000.00000000.00000000.00000000
• 239.255.255.255 = 11101111.11111111.11111111.11111111

Class E: (240. 0. 0. 0 – 255.255.255.255)

• 240. 0. 0. 0 = 11110000.00000000.00000000.00000000
• 255.255.255.255 = 11111111.11111111.11111111.11111111

## IP Address classes: Chart Representation

 Address Classes Range Bit Pattern of 1st byte Decimal Range Default Subnet Mask Reserved for A 1.0.0.0 to 126.255.255.255 0xxxxxxx 1 to 127 255.0.0.0 Governments B 128.0.0.0 to 191.255.255.255 10xxxxxx 128-191 255.255.0.0 Medium Companies C 192.0.0.0 to 223.255.255.255 110xxxxx 192-223 255.255.255.0 Small Companies D 224.0.0.0 to 239.255.255.255 1110xxxx 224-239 Not Applicable Reserved for Multicasting E 240.0.0.0 to 255.255.255.255 11110xxx 240-255 Not Applicable Experimental or future use