Subnet Calculator

Subnetting divides a larger network into smaller, more efficient sub-networks. This calculator takes an IPv4 address with a CIDR prefix length (e.g., 192.168.1.0/24) or a separate subnet mask and computes every detail you need: network address, broadcast address, first and last usable hosts, total and usable host counts, wildcard mask, IP class, and binary representations. A built-in CIDR cheat sheet from /8 to /32 gives quick reference for common subnet sizes, making it an essential tool for network engineers, system administrators, and students studying for CCNA or CompTIA Network+ certifications.

star 4.8
auto_awesome AI
New

Subnet calculator

Enter IP with CIDR prefix (e.g., 192.168.1.0/24) or just an IP below

tune Or enter IP and subnet mask separately
hub Network Address
192.168.1.0
cell_tower Broadcast Address
192.168.1.255
shield Subnet Mask
255.255.255.0
flip_to_back Wildcard Mask
0.0.0.255
first_page First Usable Host
192.168.1.1
last_page Last Usable Host
192.168.1.254
groups Total Addresses
256
devices Usable Hosts
254
IP Class C
CIDR Notation /24
Type Private
data_object Binary Representations
IP Address
11000000.10101000.00000001.00000000
Subnet Mask
11111111.11111111.11111111.00000000
Network Address
11000000.10101000.00000001.00000000
table_chart CIDR Cheat Sheet (/8 through /32)
CIDR Subnet Mask Total IPs Usable Hosts

tips_and_updates Tips

  • A /24 subnet has 254 usable hosts and is the most common subnet for small networks
  • The wildcard mask is the inverse of the subnet mask and is used in ACLs and OSPF configurations
  • A /32 subnet represents a single host address, commonly used for loopback interfaces
  • Private IP ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (RFC 1918)
  • Each additional prefix bit halves the number of available hosts in the subnet
  • VLSM (Variable Length Subnet Masking) lets you use different prefix lengths within the same network
  • Always reserve the first address (network) and last address (broadcast) — they cannot be assigned to hosts
  • For point-to-point links, a /30 subnet provides exactly 2 usable addresses (or use /31 per RFC 3021)
  • AWS reserves 4 addresses + broadcast in every subnet — a /28 has 11 usable hosts on AWS, not 14
  • Use the magic number trick: 256 minus the relevant mask octet equals the subnet block size

How to Calculate a Subnet: Network, Broadcast & Host Range in 3 Steps

1

Enter an IP address

Type an IPv4 address with CIDR notation (e.g., 192.168.1.0/24) or enter the IP and subnet mask separately.

2

View subnet details

See the network address, broadcast address, host range, usable hosts, subnet mask, wildcard mask, and IP class.

3

Reference the cheat sheet

Use the built-in CIDR cheat sheet to quickly look up subnet sizes from /8 through /32.

The Formula

The number of usable host addresses in a subnet is 2 raised to the power of the host bits (32 minus the prefix length), minus 2 for the network and broadcast addresses. For a /24 subnet, that is 2^8 - 2 = 254 usable hosts.

Usable Hosts = 2^(32 - prefix) - 2

lightbulb Variables Explained

  • prefix The CIDR prefix length (0-32)
  • 32 Total bits in an IPv4 address
  • 2 Subtracted for network and broadcast addresses

tips_and_updates Pro Tips

1

A /24 subnet has 254 usable hosts and is the most common subnet for small networks

2

The wildcard mask is the inverse of the subnet mask and is used in ACLs and OSPF configurations

3

A /32 subnet represents a single host address, commonly used for loopback interfaces

4

Private IP ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (RFC 1918)

5

Each additional prefix bit halves the number of available hosts in the subnet

6

VLSM (Variable Length Subnet Masking) lets you use different prefix lengths within the same network

7

Always reserve the first address (network) and last address (broadcast) — they cannot be assigned to hosts

8

For point-to-point links, a /30 subnet provides exactly 2 usable addresses (or use /31 per RFC 3021)

9

AWS reserves 4 addresses + broadcast in every subnet — a /28 has 11 usable hosts on AWS, not 14

10

Use the magic number trick: 256 minus the relevant mask octet equals the subnet block size

Calculate the network address, broadcast address, subnet mask, wildcard mask, host range, and usable host count for any IPv4 CIDR notation from /1 through /32. Built for network engineers, sysadmins, cloud architects, and students preparing for CCNA, CompTIA Network+, and CCNP exams. Includes binary breakdown, VLSM planning notes, and a full CIDR cheat sheet — all in your browser, with no IP data sent to a server.

CIDR Notation Explained: From /1 to /32 Subnet Prefix Lengths

CIDR (Classless Inter-Domain Routing), defined in RFC 4632 (1993), replaced the legacy classful system. A CIDR address has two parts — the IP address and a prefix length — separated by a slash, e.g., 192.168.1.0/24. The prefix length specifies how many leading bits identify the network; the remaining bits define hosts. A /32 is a single host (loopback or point-to-point endpoint), /31 covers two hosts (RFC 3021), /30 has four addresses with two usable, /24 the familiar 256 addresses with 254 usable, and /8 a full Class A-equivalent block of 16,777,216 addresses. CIDR enables flexible address allocation and route aggregation, making the global IPv4 routing table manageable.

IPv4 Subnet Mask Calculator: Network and Broadcast Address

Every IPv4 subnet has a network address (all host bits set to 0) and a broadcast address (all host bits set to 1). Neither can be assigned to a host; they bookend the usable range. For 10.20.30.40/26, the subnet mask is 255.255.255.192, the network address is 10.20.30.0, the broadcast is 10.20.30.63, and the usable range is 10.20.30.1 through 10.20.30.62 — 62 hosts. The network address identifies the subnet itself in routing tables; the broadcast address sends a Layer 3 packet to every host in the subnet. Modern Ethernet networks rely on these boundaries to scope ARP and DHCP traffic.

How to Calculate a Subnet Mask: Binary Breakdown Step by Step

To convert a CIDR prefix to a dotted-decimal mask, write 32 bits with the first N bits set to 1 and the rest set to 0, then group into four octets and convert each to decimal. Example: /22 → 11111111.11111111.11111100.00000000 → 255.255.252.0. To find the network address from a host IP, perform a bitwise AND of the IP with the subnet mask. For 192.168.5.130/22: 192.168.5.130 AND 255.255.252.0 = 192.168.4.0. Total addresses are 2^(32 − prefix); usable hosts are 2^(32 − prefix) − 2 except for /31 (2 usable per RFC 3021) and /32 (host route, 1 address).

Wildcard Mask Calculator: Cisco ACLs and OSPF Configuration

A wildcard mask is the bitwise inverse of a subnet mask: 1 bits in the wildcard mark 'don't care' positions. For mask 255.255.255.0 the wildcard is 0.0.0.255. Cisco IOS uses wildcard masks in standard and extended ACLs, OSPF network statements, and route-map conditions. For example, `network 10.1.1.0 0.0.0.255 area 0` places the entire 10.1.1.0/24 subnet into OSPF area 0. Wildcard masks need not be contiguous (unlike subnet masks), enabling pattern matches like 10.0.0.0 0.255.0.255 to match all addresses where the first and third octets are fixed but the second and fourth are unconstrained.

VLSM Subnet Calculator: Variable Length Subnet Masking Guide

VLSM (RFC 1812) lets you carve a single allocated block into subnets of different sizes — essential when you have point-to-point links, server VLANs, and user LANs all sharing one /22 or /20. Plan from largest to smallest: assign the biggest required subnet first, then the next, aligning each on its natural prefix boundary. From 192.168.16.0/22 (1,022 hosts), you might carve 192.168.16.0/24 (254 hosts), 192.168.17.0/25 (126 hosts), 192.168.17.128/26 (62 hosts), and 192.168.17.192/30 for a WAN link (2 hosts). VLSM is core to CCNA, CompTIA Network+, and any production IP plan — get it wrong and you waste address space or create overlapping subnets.

Class A, B, C IP Addresses: Legacy Classful vs Classless CIDR

Before CIDR, IPv4 used classful addressing: Class A (0.0.0.0–127.255.255.255, /8 default), Class B (128.0.0.0–191.255.255.255, /16 default), and Class C (192.0.0.0–223.255.255.255, /24 default). Class D (224.0.0.0–239.255.255.255) is reserved for multicast and Class E (240.0.0.0 onward) for experimental use. Classful addressing wasted addresses (a Class B with 65,534 hosts was overkill for most networks) and contributed to IPv4 exhaustion. CIDR (1993) decoupled prefix length from class, but you'll still see 'Class C' used loosely to mean '/24 home network', and many certification questions still reference classes.

Private IP Address Ranges: RFC 1918 Subnets for Home & Office

RFC 1918 reserves three ranges for private use, not routable on the public Internet: 10.0.0.0/8 (16 million addresses, common in enterprise), 172.16.0.0/12 (1 million, used by Docker default bridge and some lab networks), and 192.168.0.0/16 (65,000, the default for most home routers). Network Address Translation (NAT) maps these private addresses to a public IP for Internet egress. Other reserved ranges include 169.254.0.0/16 (link-local, RFC 3927), 127.0.0.0/8 (loopback), and 100.64.0.0/10 (carrier-grade NAT, RFC 6598). Choose 10.x for sites with many subnets, 192.168.x for small offices, and 172.16.x where 10.x is already used elsewhere.

IPv6 Subnetting Basics: /64 Prefixes and Address Architecture

IPv6 (RFC 4291) uses 128-bit addresses written in eight groups of four hex digits (e.g., 2001:db8::/32). The standard host subnet size is /64 — half of the address — leaving 64 bits for the interface identifier (often derived from the MAC via SLAAC, RFC 4862). ISPs typically assign customers a /48 or /56, allowing thousands of /64 subnets per site. Notation rules: leading zeros in each group can be omitted, and one run of all-zero groups can be compressed to '::'. The IPv4 concepts of network/broadcast don't translate cleanly: IPv6 has no broadcast (replaced by multicast and anycast). Use this calculator's binary view as a reference for prefix arithmetic.

How Many Hosts per Subnet: CIDR to Host Count Reference Table

Quick reference for usable hosts by prefix: /30 = 2 hosts (point-to-point), /29 = 6, /28 = 14, /27 = 30, /26 = 62, /25 = 126, /24 = 254, /23 = 510, /22 = 1,022, /21 = 2,046, /20 = 4,094, /19 = 8,190, /18 = 16,382, /17 = 32,766, /16 = 65,534, /12 = 1,048,574, /8 = 16,777,214. The formula is 2^(32 − prefix) − 2 for prefixes /1–/30. RFC 3021 allows /31 (2 addresses, both usable) for point-to-point WAN links to save address space. /32 represents a single host, used for loopbacks and host routes in OSPF/BGP.

Subnetting for AWS, Azure and GCP: Cloud VPC Subnet Planning

Public cloud VPCs follow CIDR rules with provider-specific reservations. AWS reserves the first four addresses (network, VPC router, DNS, future use) and the broadcast of every subnet — a /28 has 11 usable hosts on AWS, not 14. Azure VNets reserve the first three addresses plus the broadcast (also 11 usable for /28). GCP reserves the first two addresses plus the second-to-last and the broadcast in every subnet (12 usable for /28). For new VPCs, plan a /16 (65,536 addresses) primary CIDR and carve out /24 subnets per Availability Zone — public, private, and database tiers per AZ. Avoid 100.64.0.0/10 in cloud (carrier-grade NAT collisions) and check for overlap with on-prem ranges before provisioning Direct Connect, ExpressRoute, or Cloud Interconnect.

Common Subnet Calculation Mistakes: Off-by-One & Boundary Errors

Frequent subnetting mistakes: (1) Forgetting to subtract 2 for network and broadcast — a /28 has 14 usable hosts, not 16. (2) Misaligning a subnet on a non-boundary address — 10.0.0.5/29 starts at 10.0.0.0, not 10.0.0.5. (3) Confusing wildcard mask with subnet mask in Cisco ACL syntax (the ACL takes wildcard, not mask). (4) Overlapping subnets in VLSM plans — always verify each new subnet's range doesn't intersect an existing one. (5) Using cloud-reserved addresses for hosts (see Section 10). (6) Forgetting RFC 6890 special-purpose addresses (169.254.x.x link-local, 224.x.x.x multicast). Verify each subnet with this calculator before committing to your IPAM, Terraform, or router config.

CIDR Cheat Sheet: Subnet Mask, Hosts and Wildcard Mask Lookup

A complete /1–/32 reference is built into this calculator. Highlights: /30 = 255.255.255.252 mask, 0.0.0.3 wildcard, 2 hosts; /29 = 255.255.255.248, 0.0.0.7, 6 hosts; /28 = 255.255.255.240, 0.0.0.15, 14 hosts; /27 = 255.255.255.224, 0.0.0.31, 30 hosts; /26 = 255.255.255.192, 0.0.0.63, 62 hosts; /25 = 255.255.255.128, 0.0.0.127, 126 hosts; /24 = 255.255.255.0, 0.0.0.255, 254 hosts; /23 = 255.255.254.0, 0.0.1.255, 510 hosts; /22 = 255.255.252.0, 0.0.3.255, 1,022 hosts; /20 = 255.255.240.0, 0.0.15.255, 4,094 hosts; /16 = 255.255.0.0, 0.0.255.255, 65,534 hosts; /8 = 255.0.0.0, 0.255.255.255, 16,777,214 hosts. Bookmark or print this page for offline reference.

code

Embed this Subnet Calculator on your site

Free for any site. Copy the snippet below and paste into your HTML — no attribution required beyond the built-in credit link.

<iframe src="https://calculators.im/embed/subnet-calculator" width="100%" height="720" style="border:0;max-width:100%;" loading="lazy" title="Subnet Calculator by Calculators.im"></iframe>
<p style="font-size:12px;text-align:center;color:#64748b;margin-top:6px;">Powered by <a href="https://calculators.im/subnet-calculator?utm_source=embed&utm_medium=snippet&utm_campaign=subnet-calculator">Subnet Calculator</a> by Calculators.im</p>
open_in_new Preview embed Auto-resizing iframe. Mobile responsive. Works with WordPress, Ghost, Webflow, and plain HTML.

Frequently Asked Questions

sell

Tags