How the first bits of an IPv4 address determine its class — Class A (0), Class B (10), Class C (110), Class D (1110), and Class E (1111) — explained from the binary up.
Back when the IPv4 address space was first designed, the engineers at the Internet Engineering Task Force (IETF) needed a way to split the 32-bit address space into networks of different sizes. Their solution was classful addressing — a five-class system where the first few bits of the address tell you everything: which class it belongs to, how many network bits there are, and how many host addresses are available.
The system is elegantly simple when you look at it in binary. An IPv4 address is 32 bits long, typically written as four octets (e.g., 192.168.1.1). The first octet's leading bits are the class identifier:
I remember studying IP classful addressing in networking class and thinking the binary patterns were elegant. A Class A starts with 0 (addresses 0-127), Class B with 10 (128-191), and Class C with 110 (192-223). The bit prefix is the entire classification.
0 (range: 0.0.0.0 to 127.255.255.255)10 (range: 128.0.0.0 to 191.255.255.255)110 (range: 192.0.0.0 to 223.255.255.255)1110 (range: 224.0.0.0 to 239.255.255.255)1111 (range: 240.0.0.0 to 255.255.255.255)This bit-level prefix system is what makes IP class identification so fast — a router or protocol stack only needs to inspect the first 1 to 4 bits of the first octet to know exactly how to treat an address. It is binary classification at its purest, and understanding it gives you a much deeper intuition for how the early internet was architected.
Class A was designed for the largest networks. With the first bit fixed at 0, the remaining 7 bits of the first octet define the network, and the remaining 24 bits (three octets) define the host. That gives 126 usable networks (27 - 2, subtracting the all-zeros and all-ones reserved networks) and over 16 million hosts per network.
In practice, large organizations like MIT, IBM, and HP received Class A blocks back in the 1980s. If you have ever used an address starting with 10 (the RFC 1918 private block) or seen a loopback address like 127.0.0.1, you have encountered Class A addressing. The binary tells the whole story: any address whose first bit is 0, regardless of what the rest of the bits say, is Class A.
Class B splits the address evenly: 16 bits for the network and 16 bits for the host. The first two bits are fixed at 10, leaving 14 bits for the network portion. This gives 16,384 possible networks with 65,534 hosts each. It was the sweet spot for mid-sized organizations.
The 172.16.0.0/12 private range falls entirely within Class B territory. If you have worked with corporate networks, VPNs, or internal lab setups, you have almost certainly used addresses in this range. The binary tells you immediately: if the first two bits are 10, the first octet falls between 128 and 191, and you have 16 bits of host space to work with.
Class C is the most common class for small networks. It uses 24 bits for the network and only 8 bits for the host, giving 254 usable addresses per network (28 - 2). There are over 2 million possible Class C networks. The three fixed bits (110) leave 21 bits for network identification.
The 192.168.0.0/16 private range is the most recognizable Class C block globally. Every home router ships with a default network in this range. The limitation is obvious when you look at the binary: with only 8 host bits, the maximum is 254 devices per network — fine for a home or small office, but impossible for a large organization. That is exactly why Class A and B existed, and also why classful addressing ultimately gave way to CIDR.
Class D (1110) is reserved for multicast groups. Unlike Class A, B, and C, Class D addresses do not have a network/host split — the entire 32-bit address identifies a multicast group. When a host sends a packet to a Class D address, it is delivered to every host that has joined that multicast group. Protocols like IGMP and streaming video services use multicast extensively.
Class E (1111) was reserved for future and experimental use. It ranges from 240.0.0.0 to 255.255.255.255. In practice, Class E addresses are almost never used on the public internet — most operating systems and routers will not route them. The broadcast address 255.255.255.255 (binary: all 32 bits set to 1) technically falls within Class E space, though it serves a separate purpose.
The subnet mask is how you separate the network bits from the host bits. In classful addressing, each class had a default mask baked in. Seeing these masks in binary makes the pattern immediately obvious — network bits are all 1s, and host bits are all 0s.
Notice the pattern: the contiguous block of 1s in the mask directly corresponds to the network portion of the address. A Class A mask has 8 consecutive 1s, Class B has 16, and Class C has 24. This is the same concept that CIDR notation uses today — /8, /16, /24 are the exact same binary masks.
Here is the thing that surprises most people: classful addressing was officially deprecated in 1993 with the introduction of CIDR (Classless Inter-Domain Routing, RFC 1519). The internet had grown so fast that the rigid class system was wasting huge chunks of address space. A company that needed 300 addresses could not get a Class C (254 addresses — too few) and had to take a Class B (65,534 addresses — massive waste). The math simply did not add up.
CIDR solved this by removing the fixed class boundaries entirely. Instead of assuming the network/host split from the first few bits, CIDR uses an explicit prefix length written as /N. A /26 gives 62 usable addresses, a /27 gives 30, and a /28 gives 14. You get exactly what you need and nothing more.
But here is the important part: the binary prefix logic from classful addressing is not dead. Every CIDR subnet mask is still a contiguous block of 1s followed by 0s. When you write 255.255.255.192 as 11111111.11111111.11111111.11000000, you are doing exactly the same binary masking that Class A/B/C routers did in 1983. The binary fundamentals never changed — only the boundaries did. Understanding IP class binary gives you a rock-solid foundation for subnetting, VLSM, and route aggregation regardless of whether you use classful or classless notation.
Use our programming calculators to convert IP addresses between decimal, hex, and binary. See the 32-bit representation of any IP and understand how the bits map to network and host portions.
IP class binary classification is the traditional method of dividing the IPv4 address space into five classes (A through E) based on the first few bits of the 32-bit binary address. Class A starts with 0, Class B with 10, Class C with 110, Class D with 1110, and Class E with 1111. The first bits determine the network/host boundary and the total number of available networks and hosts per class.
Look at the first bits of the 32-bit binary representation. If the first bit is 0, it is Class A. If it starts with 10, it is Class B. If it starts with 110, it is Class C. If it starts with 1110, it is Class D (multicast). If it starts with 1111, it is Class E (reserved). This is a simple binary prefix check that a router or protocol stack can perform at wire speed.
Class A uses subnet mask 255.0.0.0 (binary: 11111111.00000000.00000000.00000000), meaning 8 network bits and 24 host bits. Class B uses 255.255.0.0 (binary: 11111111.11111111.00000000.00000000), meaning 16 network bits and 16 host bits. Class C uses 255.255.255.0 (binary: 11111111.11111111.11111111.00000000), meaning 24 network bits and 8 host bits.
Class D addresses range from 224.0.0.0 to 239.255.255.255. In binary, the first four bits are 1110, so the first octet falls between 11100000 (224) and 11101111 (239). Class E addresses range from 240.0.0.0 to 255.255.255.255, with the first four bits being 1111, so the first octet falls between 11110000 (240) and 11111111 (255). Class D is used for multicast groups and Class E is reserved for experimental use.
Classful addressing wasted a massive amount of IP space. A Class A network contained over 16 million addresses, far too many for most organizations. A Class C network contained only 254 addresses, often too few. This led to rapid IPv4 exhaustion. CIDR (Classless Inter-Domain Routing), introduced in 1993, replaced fixed classes with variable-length subnet masks (VLSM), allowing network engineers to carve out exactly the number of addresses needed — for example, a /27 gives 30 host addresses with no wastage.