· 4 min read
IPv4 address classes explained
Before 1993, every IPv4 address belonged to a class that decided its network size. The scheme is obsolete, but the terms survive in exams, old documentation and default subnet masks. This is what the classes were and why they were dropped.
On this page
What the classes were#
In the original design of IPv4 (RFC 791) the size of a network was read from the first few bits of its addresses. There were three sizes for ordinary networks, one range for multicast and one held back. Routers did not need to be told where the network part ended: the first bits said so. This is classful addressing.
| Class | First bits | First octet | Default mask | Networks | Hosts per network |
|---|---|---|---|---|---|
| A | 0 | 1 to 126 | 255.0.0.0 (/8) | 126 | 16,777,214 |
| B | 10 | 128 to 191 | 255.255.0.0 (/16) | 16,384 | 65,534 |
| C | 110 | 192 to 223 | 255.255.255.0 (/24) | 2,097,152 | 254 |
| D | 1110 | 224 to 239 | Not applicable | Multicast groups | Not applicable |
| E | 1111 | 240 to 255 | Not applicable | Reserved | Not applicable |
First octet 0 is "this network" and 127 is loopback, which is why class A stops at 126. Two host addresses in each network are unusable: the all-zeros network address and the all-ones broadcast address.
Reading the class from an address takes seconds. 10.4.7.9 starts with 0 in binary (10 is 00001010), so it is class A. 172.16.3.1 starts 10 (172 is 10101100): class B. 192.168.1.1 starts 110 (192 is 11000000): class C. 224.0.0.251, used by mDNS, starts 1110: class D, multicast.
Why the system was dropped#
Three sizes turned out to be far too few. A class C, 254 hosts, was too small for most organisations, and a class B, 65,534 hosts, was far too large for many. An organisation with 500 machines had to take a whole class B and waste over 99% of it. Meanwhile, the number of separate networks grew until routing tables were straining the hardware of the early 1990s.
- Addresses were wasted in fixed-size chunks. A class A held 16.7 million addresses, and there were only 126 of them.
- Routing tables grew. Every class C was a separate route, and there were over two million possible ones.
- Subnetting was a patch. It let one class block be split internally, but the outside world still saw the fixed classes.
The fix was Classless Inter-Domain Routing, CIDR, introduced in 1993 and now specified in RFC 4632. It drops the classes and lets any prefix length from /0 to /32 mark the split between network and host, so a network can have 500 hosts and get a /23 with 510 usable addresses. It also lets a provider announce many small blocks as one route. See CIDR and subnetting.
The private ranges, in class terms#
The three private blocks reserved by RFC 1918 line up with the old classes, which is the reason they have the sizes they do. Reading them in class terms explains the notation you still meet in router menus.
| Block | In class terms | Written today |
|---|---|---|
10.0.0.0 to 10.255.255.255 | One class A network | 10.0.0.0/8 |
172.16.0.0 to 172.31.255.255 | Sixteen class B networks in a row | 172.16.0.0/12 |
192.168.0.0 to 192.168.255.255 | 256 class C networks in a row | 192.168.0.0/16 |
Sixteen class B networks is the same thing as a /12: four bits of the second octet are free to vary. See public vs private IP addresses for how these ranges are used.
That is also why a home router almost always hands out 192.168.1.x addresses with a mask of 255.255.255.0. The block is a class C, and the mask is the default a class C would have had. Nothing in the address forces the /24, only habit and default settings.
Where the classes still show up#
- Exams and textbooks. Many networking certifications still ask you to identify a class.
- Default subnet masks. Some older operating system dialogs and tools suggest
255.255.255.0for a192.168.x.xaddress because it was a class C. - Language. "Class A" and "class C" survive as shorthand for "a
/8" and "a/24", and10.0.0.0/8is still sometimes called "the class A private block". - Multicast. The class D range,
224.0.0.0/4, is still exactly what it was, and is where multicast addresses live.
Common questions#
Which class is 192.168.1.1?
Class C by the old scheme, because it starts 110. In current practice it is a private address, usually in a /24. The private ranges are listed in their own guide.
Is class E usable?
Not on the public internet. It is reserved and most software refuses to use it.
How many usable hosts does a /24 have?
254. The 256 addresses less the network address and the broadcast address. The subnet calculator works this out for any prefix.
Try it on your own connection
Sources and further reading
- RFC 791: Internet Protocol — Section 3.2 describes the original classes.
- RFC 4632: Classless Inter-domain Routing (CIDR)
Keep reading
- Addressing and routingCIDR notation and subnetting explainedCIDR notation like 192.168.10.0/26 says how many bits name the network. How to read it, calculate a subnet by hand, and split a network into smaller ones.
- Addressing and routingPublic vs private IP addressesYour devices have a private address from your router and share one public address with the internet. The ranges, how NAT links them, and how to tell which is which.
- FundamentalsWhat is an IP address?An IP address is the label that lets devices find each other on a network. What one looks like, who assigns it, and what it can and cannot reveal about you.
- FundamentalsThe complete guide to IP addressesOne reference for the whole subject: how addresses are built, the reserved ranges you will meet, how they are allocated and routed, and how to read a lookup result.
Published by My IP Address