Subnet Calculator — IP Address, CIDR, Subnet Mask, and Host Range
⚡ Interactive calculator
Enter your values below — results appear instantly
What information does a subnet calculation give you?
| Output | Example (/24 network) | Description |
|---|---|---|
| Network address | 192.168.1.0 | First address — identifies the network (not assignable to hosts) |
| Subnet mask | 255.255.255.0 | Binary mask defining network vs host portions |
| Broadcast address | 192.168.1.255 | Last address — sends to all hosts (not assignable) |
| First usable host | 192.168.1.1 | First IP address assignable to a device |
| Last usable host | 192.168.1.254 | Last IP address assignable to a device |
| Number of usable hosts | 254 | 2⁸ − 2 = 256 − 2 (network + broadcast) |
CIDR prefix length reference table
| CIDR | Subnet Mask | Total Addresses | Usable Hosts | Use Case |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 | Large enterprise / ISP |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Large LAN |
| /24 | 255.255.255.0 | 256 | 254 | Standard office network |
| /25 | 255.255.255.128 | 128 | 126 | Small department |
| /26 | 255.255.255.192 | 64 | 62 | Small team |
| /27 | 255.255.255.224 | 32 | 30 | Small subnet |
| /28 | 255.255.255.240 | 16 | 14 | Very small subnet |
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point links |
| /32 | 255.255.255.255 | 1 | 0 | Single host (loopback, static route) |
Private IP address ranges (RFC 1918)
These ranges are reserved for private networks and are not routable on the public internet: 10.0.0.0/8 (10.0.0.0–10.255.255.255 — large networks), 172.16.0.0/12 (172.16.0.0–172.31.255.255 — medium networks), 192.168.0.0/16 (192.168.0.0–192.168.255.255 — home and small office networks). All home routers use the 192.168.x.x range. See also: the Hex to Decimal Converter and the Password Generator.
Frequently asked questions
What is a subnet mask?
A subnet mask is a 32-bit number that defines which portion of an IP address identifies the network and which identifies the host. 255.255.255.0 in binary: 24 ones followed by 8 zeros — meaning the first 24 bits are the network (/24 in CIDR), and the last 8 bits identify up to 254 hosts.
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its prefix length together: 192.168.1.0/24. The /24 means 24 bits are the network portion. Equivalent to subnet mask 255.255.255.0. CIDR replaced the old Class A/B/C system and allows more flexible network sizing.
How many usable hosts does a /24 subnet have?
A /24 subnet has 256 total addresses (2⁸). Subtract 2: the network address (first) and broadcast address (last). Result: 254 usable host addresses. Formula: Usable hosts = 2^(32−prefix) − 2. /25 = 126. /26 = 62. /27 = 30. /28 = 14. /30 = 2 (used for point-to-point router links).
How do you find the broadcast address of a subnet?
Set all host bits to 1. For 192.168.1.0/24: the last 8 bits are host bits. All 1s in 8 bits = 255. Broadcast = 192.168.1.255. For 10.0.0.0/8: last 24 bits are host bits. Broadcast = 10.255.255.255.
What is the difference between a router and a switch in subnets?
A switch connects devices within the same subnet — it uses MAC addresses and does not modify the IP header. A router connects different subnets and the internet — it uses IP addresses to route packets between networks. A default gateway is the router's IP address that hosts send traffic to when the destination is in a different subnet.
Sources & References
Sources: RFC 1918 — Address Allocation for Private Internets (IETF); RFC 4632 — CIDR notation; IANA — IPv4 Special-Purpose Address Registry; Cisco Networking Academy — Subnetting fundamentals.
How to subnet a /24 network into smaller subnets
A common task: divide a 192.168.1.0/24 network into 4 equal subnets. Each subnet gets /26 (64 addresses, 62 usable):
| Subnet | Network Address | Usable Range | Broadcast |
|---|---|---|---|
| Subnet 1 | 192.168.1.0/26 | 192.168.1.1 – .62 | 192.168.1.63 |
| Subnet 2 | 192.168.1.64/26 | 192.168.1.65 – .126 | 192.168.1.127 |
| Subnet 3 | 192.168.1.128/26 | 192.168.1.129 – .190 | 192.168.1.191 |
| Subnet 4 | 192.168.1.192/26 | 192.168.1.193 – .254 | 192.168.1.255 |
Formula: to split a /n into X equal subnets, you need log₂(X) additional bits. Splitting /24 into 4 subnets: log₂(4) = 2 extra bits → /24+2 = /26. Into 8 subnets: log₂(8) = 3 → /27.
Wildcard masks vs subnet masks
Wildcard masks are the inverse of subnet masks, used in Cisco ACLs (Access Control Lists) and OSPF routing. Wildcard = 255.255.255.255 − Subnet mask.
| CIDR | Subnet Mask | Wildcard Mask | Use Case |
|---|---|---|---|
| /24 | 255.255.255.0 | 0.0.0.255 | Match any host in /24 network |
| /25 | 255.255.255.128 | 0.0.0.127 | Match half of /24 |
| /32 | 255.255.255.255 | 0.0.0.0 | Match exact single host |
| /0 | 0.0.0.0 | 255.255.255.255 | Match all addresses (any/any) |
Example ACL: permit ip 192.168.1.0 0.0.0.255 — permits all hosts in the 192.168.1.0/24 network.
IPv6 subnetting basics
IPv6 uses 128-bit addresses (vs 32-bit IPv4). Standard allocation: ISPs assign /48 to businesses, /56 to home users, /64 to individual network segments. A /64 prefix provides 2⁶⁴ = ~18.4 quintillion host addresses per subnet — enough that subnetting within a /64 is rarely needed. IPv6 CIDR notation works identically to IPv4: 2001:db8::/32 is a /32 prefix. The subnet calculator handles IPv4; for IPv6 subnetting use a dedicated IPv6 tool.
Sources: RFC 1918 (private addresses); RFC 4632 (CIDR); RFC 4291 (IPv6 addressing); Cisco Networking Academy subnetting curriculum.
Common subnetting mistakes and how to avoid them
| Mistake | Example Error | Fix |
|---|---|---|
| Assigning the network address to a host | Giving 192.168.1.0 to a device | First usable host is network+1: 192.168.1.1 |
| Assigning the broadcast address to a host | Giving 192.168.1.255 to a device | Last usable host is broadcast−1: 192.168.1.254 |
| Subnet mask doesn't match CIDR prefix | /24 configured but mask set to 255.255.0.0 (/16) | Always verify CIDR and mask match |
| Forgetting to increment network address between subnets | Two subnets both starting at .0 | Second subnet starts at first subnet's broadcast+1 |
| Using /31 and expecting 2 hosts | /31 = 2 addresses but 0 usable (traditional) | RFC 3021 allows /31 for point-to-point — but verify device support first |
Private IP ranges and when to use each
RFC 1918 defines three private IPv4 ranges — none are routable on the public internet without NAT. Choosing which range to use: 10.0.0.0/8 (10.x.x.x): largest range, 16.7 million addresses — use for large enterprise networks, data centres, VPNs. 172.16.0.0/12 (172.16–31.x.x): 1 million addresses — use for medium networks; less common. 192.168.0.0/16 (192.168.x.x): 65,534 addresses per /24 subnet — default for all home routers and small offices. APIPA: 169.254.x.x — assigned automatically when DHCP fails; always indicates a network problem. 127.0.0.1: loopback address (localhost) — represents the device itself. Related: Password Generator · hex converter for network access credentials.
VLSM: Variable Length Subnet Masking explained
Fixed-size subnetting wastes IP addresses when different network segments have different size requirements. VLSM allocates each subnet only as many addresses as it needs. Example: you have 192.168.1.0/24 (256 addresses) and need 3 subnets: one for 100 hosts, one for 50 hosts, one for 20 hosts.
| Department | Hosts Needed | Subnet | Addresses | Waste |
|---|---|---|---|---|
| Engineering | 100 | 192.168.1.0/25 | 126 usable | 26 addresses |
| Sales | 50 | 192.168.1.128/26 | 62 usable | 12 addresses |
| Management | 20 | 192.168.1.192/27 | 30 usable | 10 addresses |
| Remaining | — | 192.168.1.224/27 | 30 usable | Available for future use |
Without VLSM, you would need three /25 subnets (using all 256 addresses with no room to grow). VLSM leaves an entire /27 available for future expansion.
Point-to-point links: why /30 is the standard
A /30 subnet has 4 addresses: 1 network address, 2 usable host addresses, 1 broadcast address. This is perfect for a link between two routers, where only 2 devices need IPs. Using a /24 for a router-to-router link would waste 252 usable addresses. Common point-to-point /30 block: 10.0.0.0/30 — Router A gets 10.0.0.1, Router B gets 10.0.0.2, network is 10.0.0.0, broadcast is 10.0.0.3.
Wildcard masks: the inverse of subnet masks
Wildcard masks are used in Cisco ACLs (Access Control Lists) and OSPF configuration — they are the bitwise inverse of a subnet mask. Convert: subtract each octet of the subnet mask from 255.
| Subnet Mask | Wildcard Mask | Matches |
|---|---|---|
| 255.255.255.0 (/24) | 0.0.0.255 | Any host in the /24 network |
| 255.255.255.252 (/30) | 0.0.0.3 | 4 addresses in the /30 subnet |
| 255.255.0.0 (/16) | 0.0.255.255 | Any host in the /16 network |
| 255.255.255.255 (/32) | 0.0.0.0 | Exact host match only |
| 0.0.0.0 (any) | 255.255.255.255 | All hosts (permit/deny any) |
Common subnetting mistakes to avoid
- Using the network address as a host IP: The first address in any subnet is the network address — never assignable to a device.
- Using the broadcast address: The last address in any subnet is the broadcast — never assignable to a device.
- Overlapping subnets: Always verify that your subnets don't overlap using the network and broadcast addresses as boundaries.
- Forgetting gateway from usable count: If your router uses one IP in the subnet, your practical usable host count = (2ⁿ−2) − 1.
- Confusing /31 and /30: A /31 has 2 addresses (no broadcast per RFC 3021 for point-to-point) but many devices don't support it; use /30 for compatibility.
Sources: Cisco IOS Subnet Masking Guide; RFC 950 (Subnetting); RFC 3021 (/31 point-to-point links).