⚡ SmartDevTools

CIDR and Subnet Basics for Beginners

By SmarTech Apps · Published 2026-11-18 · 6 min read

Subnetting looks like arcane arithmetic until you notice that it is just binary with a line drawn through it. Once you see an IPv4 address as 32 bits and a prefix as "how many of them name the network", the masks, broadcast addresses and host counts all fall out of a few simple rules. This guide builds that picture and works one complete example you can check by hand.

An IPv4 address is 32 bits

The familiar dotted quad, such as 192.168.10.37, is four 8-bit numbers (octets) written in decimal and separated by dots. Underneath it is a single 32-bit value:

192      .168      .10       .37
11000000 .10101000 .00001010 .00100101

If binary conversion is unfamiliar, the Number Base Converter will do it for you. The key point: an address is split into a network part on the left and a host part on the right. All machines in the same subnet share the network part.

Prefix length and netmask

CIDR (Classless Inter-Domain Routing) notation writes the split as a slash and a number: 192.168.10.37/26 means the first 26 bits are the network and the remaining 6 are the host. The same information can be written as a netmask: 26 ones followed by 6 zeros, which is 11111111.11111111.11111111.11000000 or 255.255.255.192. The two forms are interchangeable. Before CIDR, the split was fixed by class (A, B, C); today it is arbitrary, which is why the old "class" labels are mostly historical.

The rules

Worked example: 192.168.10.37/26

Step 1: a /26 leaves 32 - 26 = 6 host bits, so the block holds 26 = 64 addresses, and 62 are usable.

Step 2: the mask is 255.255.255.192. The first three octets are fully network, so only the last octet needs work. A block size of 64 means the subnets in this /24 start at 0, 64, 128 and 192.

Step 3: find which block contains 37. It is between 0 and 63, so the network address is 192.168.10.0.

Step 4: the broadcast is the last address in that block: 192.168.10.63.

Step 5: usable hosts run from 192.168.10.1 to 192.168.10.62.

Network    192.168.10.0/26
Mask       255.255.255.192
Broadcast  192.168.10.63
Hosts      192.168.10.1 - 192.168.10.62  (62 usable of 64)

These figures were confirmed with Python's ipaddress module, and the IP Subnet Calculator gives the same answer: type 192.168.10.37/26 and press Calculate. It shows the network address, broadcast address, subnet mask, wildcard mask, first and last usable host, total addresses, usable hosts and the IP class. It handles IPv4 only. The wildcard mask is simply the inverse of the netmask, here 0.0.0.63, and is used in some router access lists.

Common prefix sizes

PrefixNetmaskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/26255.255.255.1926462
/28255.255.255.2401614
/30255.255.255.25242
/31255.255.255.25422 (point-to-point, RFC 3021)
/32255.255.255.2551a single host

Two exceptions to the "minus two" rule: a /31 is used on point-to-point links with no network or broadcast address, and a /32 identifies one host, as in a firewall rule or a route to a single IP.

Special and private ranges

RFC 1918 reserves three blocks for private networks that are not routed on the public internet:

Other ranges worth recognising: 100.64.0.0/10 is shared address space for carrier-grade NAT (CGNAT), which ISPs use between you and their NAT, and is a frequent surprise when a VPN overlaps it. 127.0.0.0/8 is loopback (127.0.0.1 is "this machine"), and 169.254.0.0/16 is link-local, what a device assigns itself when DHCP fails. If you see 169.254.x.x on a machine, name resolution and DHCP are the first places to look; the DNS Lookup tool can check what a hostname resolves to.

Splitting and summarising

Every extra prefix bit halves a block. Splitting 192.168.10.0/24 by two bits (/24 to /26) gives four subnets of 64 addresses:

192.168.10.0/26     hosts .1   - .62
192.168.10.64/26    hosts .65  - .126
192.168.10.128/26   hosts .129 - .190
192.168.10.192/26   hosts .193 - .254

The reverse is summarising (supernetting): merging adjacent blocks into one shorter prefix, which keeps routing tables small. Four consecutive /24s starting on a multiple of four, like 192.168.0.0/24 to 192.168.3.0/24, collapse into 192.168.0.0/22. The blocks must be contiguous and aligned: a /22 has to start on an address divisible by 1024, so 192.168.1.0/22 is not a valid network.

Practical sizing in cloud networks

When you design a VPC, leave room to grow, because changing a subnet's size later is painful. Choose a roomy primary block such as a /16 and carve it into /24 or larger subnets per tier and availability zone. Avoid overlapping the ranges of networks you may later connect through peering or a VPN. Also remember that clouds reserve addresses of their own: in AWS, five addresses in every subnet are reserved (the network address, the VPC router, the DNS server, one for future use and the broadcast), so a /28 subnet, AWS's smallest, offers 11 usable addresses rather than 14.

A short IPv6 note: addresses are 128 bits, and the conventional subnet is a /64, leaving 64 bits for hosts. You do not count hosts to save space; the arithmetic is the same idea at a much bigger scale. This guide's calculator does not cover IPv6.

Subnet maths shows up at the edges of other topics too. A firewall rule with /32 allows exactly one host, and when a request is blocked, the status code it returns is explained in HTTP status codes explained. Practise with the IP Subnet Calculator, predict the network and broadcast by hand first, and you will quickly be reading prefixes at a glance.

Try the tools

Keep reading