IP Addressing &
Subnetting Cheatsheet
A quick reference guide for understanding IP addressing, subnetting, and network calculations — including an interactive subnet calculator.
🌐 1. IPv4 Basics
An IPv4 address is a 32-bit number written as four decimal octets
separated by dots, for example 192.168.1.1. Each octet is 8 bits, giving values
from 0 to 255.
Every IP address has two logical parts — the network portion (identifies the network) and the host portion (identifies the device on that network). The subnet mask determines where the boundary falls.
# Example: 192.168.1.100 / 255.255.255.0 IP Address : 192.168.1.100 11000000.10101000.00000001.01100100 Subnet Mask: 255.255.255.0 11111111.11111111.11111111.00000000 └────────────────────────┘└───────┘ Network bits (24) Host bits (8) Network : 192.168.1.0 # all host bits → 0 Broadcast : 192.168.1.255 # all host bits → 1 Usable IPs : 192.168.1.1 → 192.168.1.254 # 254 hosts
📋 2. IP Classes (A – E)
Classful addressing divides IPv4 space into five classes based on the leading bits of the first octet.
| Class | Range (1st Octet) | Default Subnet Mask | Network / Host Bits | Max Networks | Hosts/Network | Use |
|---|---|---|---|---|---|---|
| A | 1 – 126 | 255.0.0.0 /8 | 8 / 24 | 126 | 16,777,214 | Large enterprises, ISPs |
| B | 128 – 191 | 255.255.0.0 /16 | 16 / 16 | 16,384 | 65,534 | Medium-large organisations |
| C | 192 – 223 | 255.255.255.0 /24 | 24 / 8 | 2,097,152 | 254 | Small networks, home/SOHO |
| D | 224 – 239 | N/A | N/A | N/A | N/A | Multicast groups |
| E | 240 – 255 | N/A | N/A | N/A | N/A | Reserved / experimental |
⚠️
127.x.x.x is reserved for loopback (127.0.0.1). Classful
addressing is largely superseded by CIDR but remains essential knowledge.
🔒 3. Public vs Private IP Addresses
Private IP ranges are defined in RFC 1918 and are not routable on the public internet. They allow organisations to reuse address space internally, with NAT (Network Address Translation) mapping them to a public IP at the gateway.
# RFC 1918 — Private address ranges Class A 10.0.0.0 – 10.255.255.255 # /8 — 16,777,216 addresses Class B 172.16.0.0 – 172.31.255.255 # /12 — 1,048,576 addresses Class C 192.168.0.0 – 192.168.255.255 # /16 — 65,536 addresses # Other special ranges 127.0.0.0/8 # Loopback (localhost) 169.254.0.0/16 # APIPA / link-local (no DHCP available) 0.0.0.0/8 # "This" network (source only)
NAT in brief: a router replaces the private source IP with its own public IP before forwarding packets to the internet, then reverses the translation for return traffic. This conserves public address space and adds a layer of obscurity.
✂️ 4. Subnetting Basics
Subnetting divides a larger network into smaller, logically separated segments. Two equivalent notations exist:
Dotted-decimal notation
IP : 192.168.1.0 Mask : 255.255.255.0 # 255 = all 8 bits on # 0 = all 8 bits off
CIDR notation
IP/prefix: 192.168.1.0/24 # /24 = 24 network bits # 32 - 24 = 8 host bits # 2^8 - 2 = 254 usable hosts
The /prefix (CIDR prefix length) tells you how many of the 32 bits are used for the network portion. Subtracting from 32 gives the number of host bits. Usable hosts = 2host bits − 2 (subtract 1 for the network address and 1 for broadcast).
📊 5. Subnet Quick-Reference Table
Common CIDR prefixes from /8 to /30 with their subnet masks and usable host counts.
| CIDR | Subnet Mask | Wildcard Mask | Host Bits | Usable Hosts | Total Addresses |
|---|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 24 | 16,777,214 | 16,777,216 |
| /16 | 255.255.0.0 | 0.0.255.255 | 16 | 65,534 | 65,536 |
| /20 | 255.255.240.0 | 0.0.15.255 | 12 | 4,094 | 4,096 |
| /22 | 255.255.252.0 | 0.0.3.255 | 10 | 1,022 | 1,024 |
| /23 | 255.255.254.0 | 0.0.1.255 | 9 | 510 | 512 |
| /24 | 255.255.255.0 | 0.0.0.255 | 8 | 254 | 256 |
| /25 | 255.255.255.128 | 0.0.0.127 | 7 | 126 | 128 |
| /26 | 255.255.255.192 | 0.0.0.63 | 6 | 62 | 64 |
| /27 | 255.255.255.224 | 0.0.0.31 | 5 | 30 | 32 |
| /28 | 255.255.255.240 | 0.0.0.15 | 4 | 14 | 16 |
| /29 | 255.255.255.248 | 0.0.0.7 | 3 | 6 | 8 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 | 2 | 4 |
🧮 6. Subnetting — Step-by-Step Example
Given: 192.168.10.55 /26 — find the network, broadcast, and
usable host range.
255.255.255.192 (last octet: 11000000 = 192)192.168.10.0.192.168.10.63.192.168.10.1 | Last = broadcast − 1 = 192.168.10.62. Total usable = 26 − 2 = 62 hosts.# Summary for 192.168.10.55 /26 Network Address : 192.168.10.0 Subnet Mask : 255.255.255.192 (/26) Broadcast : 192.168.10.63 First Usable IP : 192.168.10.1 Last Usable IP : 192.168.10.62 Usable Hosts : 62
⚡ Interactive Subnet Calculator
Enter an IP address and a subnet mask (dotted-decimal or CIDR prefix) to instantly calculate all network values.
Click the copy icon on any result to copy to clipboard.