Classful and classless addressing describe two different ways to structure an IPv4 address. Classful addressing came first, in the early internet of the 1980s. It used fixed Class A, B, and C ranges. That rigid structure eventually led to serious IPv4 address exhaustion. CIDR arrived in 1993 and introduced classless addressing instead, allowing flexible prefixes like /20 instead of forcing every network into one of three fixed sizes.
Classful addressing gives you a three-part view of an address: network, subnet, and host. Classless addressing simplifies that to two parts: network and host. With classful addressing, the network prefix is always /8, /16, or /24, based on which class the address falls into. There’s no in-between.
Classful Addressing
Every router interface on a network requires an IP address and a subnet mask. The IP address identifies the device. The subnet mask identifies the network’s boundary. Prefix length and subnet mask are just two different ways of writing the same information.
For IPv4 subnetting, you borrow host bits and turn them into network bits. That’s how you create smaller sub-networks out of one larger one. You can do this with either classful or classless subnetting.
Borrowing more host bits gets you more sub-networks, each one smaller. Every IPv4 address has 4 octets. Classful addressing sticks to the natural boundaries between them: /8, /16, and /24. Subnetting exactly at those boundaries is the simplest case.
| Class | HOB | Net ID Bits | Host ID Bits | Number of Networks | Hosts Per Network | Start Address | End Address |
|---|---|---|---|---|---|---|---|
| Class A | 0 | 8 | 24 | 2⁷ = 128 | 2²⁴ = 16,777,216 | 0.0.0.0 | 127.255.255.255 |
| Class B | 10 | 16 | 16 | 2¹⁴ = 16,384 | 2¹⁶ = 65,536 | 128.0.0.0 | 191.255.255.255 |
| Class C | 110 | 24 | 8 | 2²¹ = 2,097,152 | 2⁸ = 256 | 192.0.0.0 | 223.255.255.255 |
| Class D | 1110 | – | – | – | – | 224.0.0.0 | 239.255.255.255 |
| Class E | 1111 | – | – | – | – | 240.0.0.0 | 255.255.255.255 |
Note: these ranges include the network and broadcast addresses, not just usable hosts.
Classful Subnetting
Subnetting on an octet boundary is called classful subnetting, and it’s the easiest case to understand. Here’s a worked example.
Say you have the network 120.0.0.0/8, all in one broadcast domain. That’s 16,777,214 usable hosts, technically. In practice, that’s a disaster. A broadcast domain that large generates enormous broadcast traffic. It strains switches. It kills performance. You need to break it up.
Subnetting at /16. Borrow 8 bits from the host portion, and 120.0.0.0/8 splits into 256 sub-networks, from 120.0.0.0/16 through 120.255.0.0/16. Each one holds 65,534 usable hosts. The first two octets identify the network. The last two identify the host.
| Subnet (/16) | 1st Usable IP | Last Usable IP | Broadcast Address |
|---|---|---|---|
| 120.0.0.0/16 | 120.0.0.1 | 120.0.255.254 | 120.0.255.255 |
| 120.1.0.0/16 | 120.1.0.1 | 120.1.255.254 | 120.1.255.255 |
| 120.2.0.0/16 | 120.2.0.1 | 120.2.255.254 | 120.2.255.255 |
| … | … | … | … |
| 120.255.0.0/16 | 120.255.0.1 | 120.255.255.254 | 120.255.255.255 |
Subnetting at /24. Borrow 16 bits instead. You get 65,536 sub-networks, from 120.0.0.0/24 through 120.255.255.0/24. Each one holds 254 usable hosts, not 256. That distinction matters. 256 is the total address count in a /24 block. Two of those addresses can never be assigned to a device: the network address and the broadcast address. The first three octets identify the network here. The last octet identifies the host.
| Subnet (/24) | 1st Usable IP | Last Usable IP | Broadcast Address |
|---|---|---|---|
| 120.0.0.0/24 | 120.0.0.1 | 120.0.0.254 | 120.0.0.255 |
| 120.0.1.0/24 | 120.0.1.1 | 120.0.1.254 | 120.0.1.255 |
| 120.0.2.0/24 | 120.0.2.1 | 120.0.2.254 | 120.0.2.255 |
| … | … | … | … |
| 120.255.255.0/24 | 120.255.255.1 | 120.255.255.254 | 120.255.255.255 |

This is the pattern worth internalizing: every time you borrow 8 more bits, your subnet count multiplies by 256. Your host count per subnet shrinks by roughly the same amount. That relationship holds at every octet boundary, no exceptions.
Classless Subnetting
Classful subnetting works within the default masks tied to each class:
- Class A: 0–127, mask 255.0.0.0 (/8)
- Class B: 128–191, mask 255.255.0.0 (/16)
- Class C: 192–223, mask 255.255.255.0 (/24)
- Class D: 224–239, reserved for multicast, not used for host addressing
- Class E: 240–255, reserved for experimental use, not routable
A router configured with classful addressing doesn’t include subnet mask information in its routing updates. It just assumes its own subnet mask, or defaults to the classful subnet mask for whatever class the address falls into. This is a real limitation. Every subnet within a given classful network has to be the same size.
Classless subnetting removes that limit. It supports Variable-Length Subnet Masks, or VLSM, letting different subnets within the same network use different sizes depending on what each one actually needs. A classless IP address uses a custom subnet mask instead of a fixed classful default, and routers running classless addressing do include that mask information in their routing updates. This is exactly why classful routing protocols like RIPv1 can’t support VLSM, while classless protocols like OSPF and EIGRP can.
Four Real Classless Examples, Explained
Classless addressing lets you pick a prefix length based on actual need, not a fixed class boundary. Here’s what that looks like in practice.
120.210.0.0/17. A /17 borrows one bit past the classful /16 boundary for a Class A-range address. That gives you 2 subnets of this size within the original /16, each with 32,766 usable hosts. Useful for a very large site that still doesn’t need the full 65,534 hosts a /16 would offer.
20.6.150.0/28. A /28 is a small block: just 16 total addresses, 14 usable. This size shows up constantly for point-to-point links, small server clusters, or tightly scoped management networks where you genuinely don’t need more than a handful of addresses.
172.31.16.0/21. A /21 sits comfortably between a /24 and a /16. It gives you 2,046 usable hosts. This is a common choice for a mid-sized office. It also works well as a summarized block covering several smaller subnets underneath it, similar to the CIDR summarization technique used in route aggregation.
172.16.16.0/20. A /20 gives you 4,094 usable hosts, twice the size of the /21 above. This size often shows up as a larger campus or branch allocation. It’s big enough for future growth, without being wasteful the way a full classful /16 would be.
None of these four examples would be possible under strict classful addressing. Each one uses a prefix length chosen for the actual requirement, not forced into /8, /16, or /24.

Subnetting Formulas — Valid for Both Classful and Classless Addressing
Two formulas cover almost everything you need:
Number of subnets = 2ⁿ, where n is the number of bits borrowed from the host portion.
Number of usable hosts per subnet = 2ʰ − 2, where h is the number of bits remaining in the host portion.
The minus 2 in the second formula matters. Two addresses in every subnet are permanently unusable. The network address is the first address, identifying the subnet itself. The broadcast address is the last, used to reach every host on that subnet at once. Neither can be assigned to an actual device.
These two formulas work identically whether you’re subnetting at a clean classful octet boundary or picking an arbitrary classless prefix like /21 or /28. The math doesn’t care which approach you’re using. Only the starting point differs.
Conclusion
Classful addressing gave the early internet a simple, predictable structure, but that simplicity came at a real cost: wasted address space, and no flexibility to size a network to its actual needs. Classless addressing, built on CIDR, fixed both problems by letting the subnet mask do the real work, instead of a fixed class boundary. Once you’re comfortable with the two core formulas, and you understand why 254 usable hosts and 256 total addresses aren’t the same number, classful and classless subnetting both come down to the same underlying binary math.
FAQs
What is the difference between classful and classless addressing?
Classful addressing uses fixed /8, /16, or /24 prefixes tied to IP address classes A, B, and C, with no flexibility in between. Classless addressing, introduced through CIDR, allows any prefix length, like /20 or /27, sized to actual network requirements instead of a rigid class boundary. This flexibility is also why classless routing protocols can support VLSM, while classful ones can’t.
How does classful subnetting work at octet boundaries?
Classful subnetting divides a network at the natural /8, /16, or /24 octet boundaries, borrowing 8 bits at a time from the host portion. For example, subnetting a /8 network down to /16 borrows 8 bits and produces 256 subnets, each with 65,534 usable hosts. This is the easiest form of subnetting to calculate by hand, since it always works in clean multiples of 256.
What is VLSM, and how is it used in classless addressing?
VLSM, or Variable-Length Subnet Masking, lets you use different subnet sizes within the same overall network, rather than forcing every subnet to match a single fixed mask. A point-to-point link might use a /30, while a large office segment nearby uses a /22, both carved out of the same parent network. This makes address allocation far more efficient than classful addressing ever allowed, since you’re not stuck wasting addresses on subnets sized larger than they need to be.
Why is classless addressing preferred in modern networks?
Classless addressing, through CIDR, dramatically reduces wasted IP address space and supports more efficient routing through route summarization. It’s also foundational to how routers handle VLSM and how ISPs allocate address blocks sized to actual customer need, rather than rounding every request up to the nearest classful size. As IPv6 adoption continues, the classless mindset (subnet masks defining network boundaries, not fixed classes) carries over directly, since IPv6 never had a classful system to begin with.
How do I calculate the number of subnets and hosts for a given prefix?
Use 2ⁿ for the number of subnets, where n is how many bits you’ve borrowed from the host portion. Use 2ʰ − 2 for the number of usable hosts per subnet, where h is how many host bits remain, subtracting 2 for the unusable network and broadcast addresses. You can also check your work with our online subnet calculator rather than doing every calculation by hand.
What tools can help with classful and classless subnetting?
An online subnet calculator is the fastest way to check your subnetting math, especially for classless prefixes that don’t land on a clean octet boundary. On live Cisco equipment, commands like show ip route and show running-config help verify what’s actually configured, rather than just what you intended to configure. Practicing the manual binary math first, then confirming with a calculator, tends to build a much stronger understanding than relying on the calculator alone.