When IPv4 was defined in 1981 (RFC 791), addresses were split into classes: the value of the first byte was enough to know where the network part ended. This system has not been used for routing since 1993, but it is still everywhere: in the vocabulary ("a class C network"), in networking certifications and in the private address ranges.
This guide assumes you know what a mask is: see IP address, subnet mask, gateway.
1. The five classes in one table
| Class | Leading bits | First byte | Default mask | Number of networks | Usable addresses per network | Use |
|---|---|---|---|---|---|---|
| A | 0 |
0 to 127 | 255.0.0.0 (/8) |
128 (126 usable) | 16,777,214 | Very large networks |
| B | 10 |
128 to 191 | 255.255.0.0 (/16) |
16,384 | 65,534 | Medium networks |
| C | 110 |
192 to 223 | 255.255.255.0 (/24) |
2,097,152 | 254 | Small networks |
| D | 1110 |
224 to 239 | none | — | — | Multicast (sending to a group) |
| E | 1111 |
240 to 255 | none | — | — | Reserved (experimental) |
In class A, two networks are reserved: 0.0.0.0/8 ("this network") and 127.0.0.0/8 (loopback, see below). Hence 126 usable networks.
2. Why the first byte is enough
The class is read from the leading bits of the address. So the first byte, in binary, gives the class directly:
| First byte | In binary | Leading bits | Class |
|---|---|---|---|
| 10 | 00001010 |
0 |
A |
| 172 | 10101100 |
10 |
B |
| 192 | 11000000 |
110 |
C |
| 230 | 11100110 |
1110 |
D |
| 245 | 11110101 |
1111 |
E |
The boundaries in the table in part 1 follow from this: as long as the first bit is 0, the byte stays below 128 (class A); starting with 10, it runs from 128 to 191 (class B), and so on.
The number of usable addresses follows the same logic: a class C leaves 8 bits for the host part, that is 2⁸ = 256 addresses, minus the network address and the broadcast address, giving 254.
3. Why classes were dropped
The system had a major flaw: there were only three network sizes, 254, 65,534 or 16,777,214 addresses.
An organisation that needed 500 addresses could not make do with a class C (254 addresses). It received a class B, 65,534 addresses, of which more than 65,000 went unused. Multiplied across thousands of organisations, this waste drained the IPv4 address pool in the early 1990s, while internet routing tables grew too fast.
The answer came in 1993: CIDR (Classless Inter-Domain Routing), whose current reference is RFC 4632.
4. CIDR: the boundary anywhere
With CIDR, the length of the network part is no longer deduced from the first byte: it is stated explicitly after the address, as a / followed by the number of bits.
| Notation | Mask | Usable addresses |
|---|---|---|
192.168.4.0/24 |
255.255.255.0 |
254 |
192.168.4.0/23 |
255.255.254.0 |
510 |
192.168.4.0/26 |
255.255.255.192 |
62 |
10.0.0.0/8 |
255.0.0.0 |
16,777,214 |
The organisation that needs 500 addresses now receives a /23 (510 addresses) instead of a whole class B. And a network can be split into subnets of whatever size you need, as explained in calculating a subnet.
"Class C" no longer means much
You often hear "a class C network" for a /24 network. That is loose talk: 10.1.1.0/24 is a /24 network, but its address belongs to the old class A. Say "a /24" instead: it is shorter and accurate.
5. What is left of classes today
Private ranges
Private addresses, free to use inside a local network but never on the internet, were defined in 1996 (RFC 1918). There is one per class:
| Range | CIDR notation | In the old class | Common use |
|---|---|---|---|
| 10.0.0.0 to 10.255.255.255 | 10.0.0.0/8 |
A | Companies, large networks |
| 172.16.0.0 to 172.31.255.255 | 172.16.0.0/12 |
B | Companies, Docker container networks |
| 192.168.0.0 to 192.168.255.255 | 192.168.0.0/16 |
C | Home routers, home networks |
Tip
The 172.16.0.0/12 range ends at 172.31.255.255. An address in 172.32.x.x or 172.15.x.x is a public address.
Special ranges
127.0.0.0/8: loopback.127.0.0.1always means the machine itself (localhost).224.0.0.0/4(the old class D): multicast, used for example by routing protocols, device discovery on the local network or IP television.240.0.0.0/4(the old class E): still reserved. Only255.255.255.255is used: it is the broadcast address limited to the local network, used in particular by a machine looking for a DHCP server.
6. Practice
For each address, find the class and the default mask. The answers are in the right-hand columns.
| Address | Class | Default mask | Note |
|---|---|---|---|
10.20.30.40 |
A | /8 | Private address |
172.20.5.1 |
B | /16 | Private address |
172.40.5.1 |
B | /16 | Public address (outside 172.16 to 172.31) |
192.168.1.42 |
C | /24 | Private address |
200.1.2.3 |
C | /24 | Public address |
127.0.0.1 |
A | /8 | Loopback |
230.0.0.5 |
D | none | Multicast |
Key takeaways
- The class is read from the first byte: A from 0 to 127, B from 128 to 191, C from 192 to 223, D (multicast) from 224 to 239, E (reserved) from 240 to 255.
- Classes imposed three network sizes; that waste led to CIDR in 1993.
- Today, a network's size is written with the prefix:
/24,/23,/26… Say "a /24" rather than "a class C". - The private ranges
10.0.0.0/8,172.16.0.0/12and192.168.0.0/16are a direct legacy of classes A, B and C.