Subnet Calculator -- CIDR, IP Range & Hosts

Calculate network address, broadcast, host range, and wildcard mask from any IPv4 address and subnet mask

Calculate Subnet Details

A subnet calculator takes an IPv4 address and subnet mask (or CIDR prefix) and returns the network address, broadcast address, usable host range, wildcard mask, and total host count. All calculations run in your browser.

Worked Examples

Example 1 — Standard /24 LAN

Input: 192.168.1.50 / 255.255.255.0 (/24)

  • Network: 192.168.1.0
  • Broadcast: 192.168.1.255
  • Usable range: 192.168.1.1 – 192.168.1.254
  • Usable hosts: 254
  • Wildcard mask: 0.0.0.255

This is the most common subnet for home and small office networks. Every device gets an address between .1 and .254.

Example 2 — Small /28 subnet (16 addresses)

Input: 10.0.5.100 / 255.255.255.240 (/28)

  • Network: 10.0.5.96
  • Broadcast: 10.0.5.111
  • Usable range: 10.0.5.97 – 10.0.5.110
  • Usable hosts: 14
  • Wildcard mask: 0.0.0.15

A /28 is useful for isolating a small group of servers or a department that needs fewer than 14 IPs.

Example 3 — Point-to-point /30 link

Input: 172.16.0.5 / 255.255.255.252 (/30)

  • Network: 172.16.0.4
  • Broadcast: 172.16.0.7
  • Usable range: 172.16.0.5 – 172.16.0.6
  • Usable hosts: 2
  • Wildcard mask: 0.0.0.3

A /30 provides exactly 2 usable addresses — one for each end of a router-to-router link.

Example 4 — Large /20 campus network

Input: 10.10.0.1 / 255.255.240.0 (/20)

  • Network: 10.10.0.0
  • Broadcast: 10.10.15.255
  • Usable range: 10.10.0.1 – 10.10.15.254
  • Usable hosts: 4,094
  • Wildcard mask: 0.0.15.255

A /20 subnet spans 16 class-C-equivalent blocks, suitable for large buildings or campus segments.

CIDR Cheat Sheet

Quick reference for all common IPv4 subnet sizes. Use this to find the right prefix length for your network.

CIDR Subnet Mask Wildcard Total IPs Usable Hosts Typical Use
/32255.255.255.2550.0.0.011Single host route
/31255.255.255.2540.0.0.122*Point-to-point (RFC 3021)
/30255.255.255.2520.0.0.342Router links
/29255.255.255.2480.0.0.786Small server group
/28255.255.255.2400.0.0.151614Small department
/27255.255.255.2240.0.0.313230Small office
/26255.255.255.1920.0.0.636462Medium office
/25255.255.255.1280.0.0.127128126Large department
/24255.255.255.00.0.0.255256254Standard LAN
/23255.255.254.00.0.1.255512510Large LAN
/22255.255.252.00.0.3.2551,0241,022Campus segment
/21255.255.248.00.0.7.2552,0482,046Large campus
/20255.255.240.00.0.15.2554,0964,094Building / campus
/16255.255.0.00.0.255.25565,53665,534Large organization
/12255.240.0.00.15.255.2551,048,5761,048,574ISP block
/8255.0.0.00.255.255.25516,777,21616,777,214Enterprise / ISP

* /31 subnets have no network or broadcast address per RFC 3021, so both addresses are usable for point-to-point links.

Private IPv4 Address Ranges (RFC 1918)

These address ranges are reserved for private networks and are not routable on the public internet. They are used in homes, offices, and data centers behind NAT.

Range CIDR Subnet Mask Total Addresses Typical Use
10.0.0.0 – 10.255.255.25510.0.0.0/8255.0.0.016,777,216Large enterprises, cloud VPCs
172.16.0.0 – 172.31.255.255172.16.0.0/12255.240.0.01,048,576Medium organizations, Docker default
192.168.0.0 – 192.168.255.255192.168.0.0/16255.255.0.065,536Home networks, small offices

Understanding Subnetting

What Is a Subnet?

A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a larger network into smaller, isolated segments. Each subnet has its own network address (the first IP, identifying the subnet), broadcast address (the last IP, used to reach all hosts), and a range of usable host addresses in between.

Why Subnet?

  • Security: Isolate sensitive systems (e.g., servers, IoT devices) from general traffic
  • Performance: Smaller subnets reduce broadcast domain size, decreasing unnecessary traffic
  • Organization: Map network structure to physical or organizational layout (floors, departments, sites)
  • Efficient IP use: Allocate only the addresses each segment needs, avoiding waste

How Subnetting Works

Every IPv4 address is 32 bits. A subnet mask divides those 32 bits into two parts: the network prefix (identifies the subnet) and the host portion (identifies the device within the subnet).

For example, with a /24 mask, the first 24 bits are the network prefix and the last 8 bits are the host portion. That gives 28 = 256 total addresses, minus 2 reserved (network + broadcast) = 254 usable hosts.

The formula for usable hosts is: 2^(32 − prefix) − 2

Subnet Mask vs. Wildcard Mask

A subnet mask like 255.255.255.0 has 1-bits for the network portion and 0-bits for the host portion. A wildcard mask is its bitwise inverse: 0.0.0.255. They encode the same information in opposite ways.

  • Subnet mask: Used in operating system network configuration, routing tables, and DHCP settings
  • Wildcard mask: Used in Cisco ACLs (access control lists), OSPF area definitions, and some firewall rules to match IP address ranges

To convert: subtract each octet of the subnet mask from 255. For 255.255.255.240: wildcard = 0.0.0.15.

VLSM — Variable Length Subnet Masking

VLSM allows different subnets within the same network to use different prefix lengths. Without VLSM (classful networking), every subnet must be the same size, which wastes addresses.

Example: You have the 10.0.0.0/24 block (256 addresses) and need to serve three groups:

  • Office A: 100 devices → /25 (126 usable hosts) → 10.0.0.0/25
  • Office B: 50 devices → /26 (62 usable hosts) → 10.0.0.128/26
  • Router link: 2 devices → /30 (2 usable hosts) → 10.0.0.192/30

With VLSM, you use only 196 addresses instead of 768 (3 × 256) under classful subnetting. The remaining space (10.0.0.196 – 10.0.0.255) stays available for future needs.

Frequently Asked Questions

What is a subnet?

A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a larger network into smaller segments, each with its own network address, broadcast address, and usable host range. Subnets improve security by isolating traffic, reduce broadcast domain size for better performance, and allow more efficient use of IP address space.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation represents an IP address and its network prefix length. It is written as an IP followed by a slash and the prefix length — for example, 192.168.1.0/24. The prefix (0–32 for IPv4) indicates how many leading bits identify the network. A /24 means the first 24 bits are network and the remaining 8 bits are for hosts.

How do I calculate the number of usable hosts?

The formula is 2^(32 − prefix) − 2. You subtract 2 because the first address (network address) and last address (broadcast address) are reserved. For example, a /24 has 28 − 2 = 254 usable hosts. A /30 has 22 − 2 = 2 usable hosts. The exception is /31, which per RFC 3021 allows both addresses as usable for point-to-point links.

What is the difference between a subnet mask and a wildcard mask?

They are bitwise inverses. A subnet mask like 255.255.255.0 uses 1-bits for the network portion and 0-bits for the host portion. The wildcard mask is 0.0.0.255 — 0-bits for network, 1-bits for hosts. Subnet masks are used in OS network configuration. Wildcard masks are used in Cisco ACLs, OSPF, and certain firewall rules.

What are private IP address ranges?

RFC 1918 defines three private ranges not routable on the public internet: 10.0.0.0/8 (~16.7 million addresses), 172.16.0.0/12 (~1 million), and 192.168.0.0/16 (~65,000). These are used for internal networks behind NAT (Network Address Translation).

What is VLSM?

VLSM (Variable Length Subnet Masking) lets you use different prefix lengths for different subnets within the same network. This avoids wasting addresses — you can use a /24 for a large office and a /30 for a router link, all from the same block.

What is a broadcast address?

The broadcast address is the last address in a subnet. Packets sent to it are delivered to all hosts on that subnet. In 192.168.1.0/24, the broadcast is 192.168.1.255. It cannot be assigned to a host.

When should I use a /30 or /31 subnet?

A /30 gives exactly 2 usable IPs — ideal for point-to-point links between routers. A /31 (RFC 3021) uses both addresses for hosts with no network or broadcast address, saving 1 IP per link. Most modern routers support /31 on point-to-point interfaces.

Does this calculator store my data?

No. All calculations run in your browser using JavaScript. No data is sent to any server.

Related Tools

Privacy & Limitations

  • All calculations run entirely in your browser -- nothing is sent to any server.
  • Results are computed locally and should be verified for critical applications.

Related Tools

View all tools

Subnet Calculator FAQ

What is a subnet?

A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting divides a larger network into smaller segments, each with its own network address, broadcast address, and range of usable host addresses. Subnets improve security by isolating traffic, reduce broadcast domain size for better performance, and allow more efficient use of IP address space.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation represents an IP address and its associated network prefix length. It is written as an IP address followed by a slash and the prefix length — for example, 192.168.1.0/24. The prefix length (0–32 for IPv4) indicates how many leading bits of the address identify the network. A /24 prefix means the first 24 bits are the network portion and the remaining 8 bits are for host addresses.

How do I calculate the number of usable hosts in a subnet?

The formula is 2^(32 − prefix length) − 2. You subtract 2 because the first address is reserved for the network address and the last address is reserved for the broadcast address. For example, a /24 subnet has 2^8 − 2 = 254 usable host addresses. A /30 subnet has 2^2 − 2 = 2 usable hosts. The exceptions are /32 (single host, 1 address) and /31 (point-to-point link per RFC 3021, 2 addresses with no broadcast).

What is the difference between a subnet mask and a wildcard mask?

A subnet mask and wildcard mask are bitwise inverses of each other. A subnet mask like 255.255.255.0 has 1-bits for the network portion and 0-bits for the host portion. The corresponding wildcard mask is 0.0.0.255 — it has 0-bits for the network portion and 1-bits for the host portion. Subnet masks are used in OS network configuration. Wildcard masks are used in Cisco ACLs, OSPF, and some firewall rules to match ranges of IP addresses.

What are private IP address ranges?

RFC 1918 defines three private IPv4 address ranges that are not routable on the public internet: 10.0.0.0/8 (10.0.0.0 – 10.255.255.255, ~16.7 million addresses), 172.16.0.0/12 (172.16.0.0 – 172.31.255.255, ~1 million addresses), and 192.168.0.0/16 (192.168.0.0 – 192.168.255.255, ~65,000 addresses). These are used for internal networks, home routers, and corporate LANs.

What is VLSM?

VLSM (Variable Length Subnet Masking) is a technique that allows different subnets within the same network to use different prefix lengths. Without VLSM, every subnet must be the same size. With VLSM, you can allocate a /24 for a large office, a /28 for a small team, and a /30 for a point-to-point router link — all from the same address block. This dramatically reduces IP address waste.

What is a broadcast address?

The broadcast address is the last address in a subnet. A packet sent to the broadcast address is delivered to all hosts on that subnet. For example, in the 192.168.1.0/24 network, the broadcast address is 192.168.1.255. The broadcast address cannot be assigned to a host — it is reserved for network-wide communication.

When should I use a /30 or /31 subnet?

A /30 subnet provides exactly 2 usable host addresses, making it ideal for point-to-point links between two routers. A /31 subnet (RFC 3021) also supports point-to-point links but uses all 2 addresses for hosts, with no network or broadcast address — saving one IP per link. Most modern routers support /31 subnets on point-to-point interfaces.

Does this calculator store my data?

No. All calculations run entirely in your browser using JavaScript. No data is sent to any server, and nothing is stored. Your IP addresses and subnet information remain completely private.

Request a New Tool
Improve This Tool