IPv4 subnetting guide
Convert CIDR manually with binary
An Internet Protocol address identifies an interface on a network. IPv4 uses 32 bits shown as four decimal octets, while IPv6 uses 128 bits commonly shown in hexadecimal groups. This guide works only with IPv4.
Private IPv4 space can be reused inside separate networks; public addresses must be globally coordinated. The complete private ranges are:
| Traditional label | Private range | CIDR | Total addresses |
|---|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 |
| B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 |
| C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 |
The class labels are historical; modern routing and subnetting use CIDR prefixes.
What CIDR means
Classless Inter-Domain Routing writes an address with a prefix length, such as 110.40.240.16/22. The number after the slash tells you how many leading bits belong to the network. The remaining bits belong to the host portion.
Convert each IPv4 octet to binary
| IPv4 address | 32-bit binary form |
|---|---|
110.40.240.16 | 01101110.00101000.11110000.00010000 |
14.12.72.8 | 00001110.00001100.01001000.00001000 |
10.98.1.64 | 00001010.01100010.00000001.01000000 |
Worked example: 110.40.240.16/22
A /22 uses 22 network bits and leaves 10 host bits.
Address: 01101110.00101000.111100|00.00010000
Mask: 11111111.11111111.111111|00.00000000
Netmask: 255.255.252.0
Set all host bits to 0 for the network address and to 1 for the broadcast address:
Network: 110.40.240.0
Broadcast: 110.40.243.255
Total: 2^10 = 1,024 addresses
Usable: 1,022 addresses
Range: 110.40.240.1 – 110.40.243.254
Worked example: 14.12.72.8/17
A /17 uses 17 network bits and leaves 15 host bits.
Address: 00001110.00001100.0|1001000.00001000
Mask: 11111111.11111111.1|0000000.00000000
Netmask: 255.255.128.0
Network: 14.12.0.0
Broadcast: 14.12.127.255
Total: 2^15 = 32,768 addresses
Usable: 32,766 addresses
Range: 14.12.0.1 – 14.12.127.254
Worked example: 10.98.1.64/28
A /28 uses 28 network bits and leaves four host bits.
Address: 00001010.01100010.00000001.0100|0000
Mask: 11111111.11111111.11111111.1111|0000
Netmask: 255.255.255.240
Network: 10.98.1.64
Broadcast: 10.98.1.79
Total: 2^4 = 16 addresses
Usable: 14 addresses
Range: 10.98.1.65 – 10.98.1.78
The traditional “total minus two” usable count applies to ordinary multi-access IPv4 subnets such as these examples. /31 point-to-point links and /32 host routes have special interpretations.
Allocate subnets from 139.145.56.0/22
The original exercise divides a /22 for four networks needing 65, 100, 33 and 13 usable addresses. For each requirement, choose the smallest power-of-two block that also accommodates network and broadcast addresses, then begin on a correctly aligned boundary.
| Network | Need | Allocated CIDR | Netmask | Broadcast | Usable range |
|---|---|---|---|---|---|
| A | 65 | 139.145.56.0/25 | 255.255.255.128 | 139.145.56.127 | 139.145.56.1 – 139.145.56.126 |
| B | 100 | 139.145.56.128/25 | 255.255.255.128 | 139.145.56.255 | 139.145.56.129 – 139.145.56.254 |
| C | 33 | 139.145.57.0/26 | 255.255.255.192 | 139.145.57.63 | 139.145.57.1 – 139.145.57.62 |
| D | 13 | 139.145.57.64/28 | 255.255.255.240 | 139.145.57.79 | 139.145.57.65 – 139.145.57.78 |
These allocations consume the beginning of the /22; the rest remains available. In operational VLSM planning, sorting requirements largest-first usually reduces alignment waste.
