# Subnet Calculator

Calculate CIDR notation, subnet masks, usable host counts, and IP address ranges instantly for accurate network planning.

---

- **Canonical URL:** https://dothecalculation.com/calculators/subnet-calculator
- **Category:** AI & Tech Development
- **Publisher:** Do The Calculation (https://dothecalculation.com)
- **Cost:** Free, no account or sign-up required
- **Privacy:** Runs entirely in the browser; inputs are never sent to a server
- **Methodology:** https://dothecalculation.com/methodology
- **Reviewed by:** Dr. James Callahan, PhD, PhD in Computer Engineering, MIT (https://dothecalculation.com/about/team/james-callahan)

---

## Deconstruct IPv4 subnets

Calculate network address, subnet mask, usable host range, broadcast address, and host capacity from an IP and CIDR prefix.

- CIDR prefix translation
- Usable host IP capacity
- Broadcast and network boundaries

## Subnetting and Network Design Principles

Subnetting is the practice of dividing a single large physical network into multiple smaller, logical subnetworks (subnets). This division is a fundamental building block of IP networking, helping to reduce broadcast storm traffic, isolate security zones, and optimize routing efficiency.

Every IPv4 address consists of two parts: the network portion (used by routers to locate the subnet) and the host portion (used to locate the specific device on that subnet). The **Subnet Mask** determines exactly where this split occurs.

## Bitwise Masking Mathematics

To calculate subnet boundaries, networking hardware performs bitwise operations on the 32-bit binary representations of the IP address and the subnet mask.

**Network Address**: Calculated by performing a bitwise AND operation between the IP address and the subnet mask:

$$\text{Network Address} = \text{IP Address} \text{ AND } \text{Subnet Mask}$$

**Broadcast Address**: Calculated by setting all host bits of the network address to binary 1:

$$\text{Broadcast Address} = \text{Network Address} \text{ OR } (\text{NOT } \text{Subnet Mask})$$

**Usable Host Range**: The IPs sitting strictly between the Network Address and the Broadcast Address. The host capacity is \(2^{(32 - ext{CIDR})} - 2\). We subtract 2 because the network address (first IP) and the broadcast address (last IP) are reserved and cannot be assigned to devices.

## CIDR Notation and Prefix Lengths

Classless Inter-Domain Routing (CIDR) notation expresses the subnet mask size as a slash followed by the count of leading binary 1s (network bits). For example, a `/24` prefix represents a mask with 24 leading 1s: `255.255.255.0`. This mask leaves 8 bits for hosts, supporting \(2^8 - 2 = 254\) usable devices.

For controlling traffic density and request flow across your subnet boundaries, you will need a robust rate limiting system. Model your request limits with our [API Rate Limiting & Token Bucket Simulator](/calculators/api-rate-limiter-calculator).

## How to Use This Calculator

Enter the four octets of an IPv4 address and a CIDR prefix length (0-32). The calculator converts the address into a 32-bit binary value, applies the subnet mask, and derives the network address, broadcast address, subnet mask, and usable host range.

This is useful for planning IP address allocation, verifying whether two hosts sit on the same subnet, or studying for networking certifications like CompTIA Network+ or the CCNA.

## Worked Example: 192.168.1.10/24

For the default input 192.168.1.10 with a /24 prefix, the subnet mask is 255.255.255.0. Applying a bitwise AND between the IP and mask gives a network address of 192.168.1.0, and setting all host bits to 1 gives a broadcast address of 192.168.1.255.

The usable host range runs from 192.168.1.1 to 192.168.1.254 — 254 usable addresses (calculated as $2^{(32-24)} - 2 = 254$, subtracting the reserved network and broadcast addresses). Any device configured with an address in that range, using the same mask, is on the same local subnet as 192.168.1.10.

## Related Calculators

For the infrastructure sitting behind a subnet, see the [network throughput & latency calculator](/calculators/network-throughput-latency-calculator) to size link capacity, or the [load balancer concurrency calculator](/calculators/load-balancer-concurrency-calculator) for gateway sizing.

If you are rate limiting traffic within this subnet, the [API rate limiter & token bucket simulator](/calculators/api-rate-limiter-calculator) helps size request throttling policies.

## Frequently asked questions

### Why are the first and last host IP addresses reserved?

The first address in a subnet is reserved for the network address itself, and the last address is reserved for the broadcast address. Usable host IPs sit between these boundaries.

### What is a subnet mask?

A 32-bit number that hides or masks the host portion of an IP address, leaving only the network portion visible to routing protocols.

### What is CIDR notation?

Classless Inter-Domain Routing notation, which specifies network prefix length (e.g., /24) to define mask size.

### How many usable hosts are in a /24 subnet?

A /24 subnet has 8 host bits, yielding 256 total addresses. Subtracting the network and broadcast addresses leaves 254 usable host IPs.

### What is a broadcast address?

An IP address used to target all hosts on a subnet simultaneously.

### How does bitwise AND work in subnetting?

The calculator compares the binary bits of the IP and mask. If both are 1, the result is 1; otherwise, it is 0, revealing the base network address.

### What is the purpose of subnetting?

Subnetting improves security, limits broadcast traffic, and organizes network devices into logical groups (e.g., separating guest WiFi from server networks).

### What is a default gateway?

A router interface that connects the local subnet to other networks. It typically takes the first or last usable IP address in the subnet.

### What is a Class A, B, and C network?

Historical legacy IP classifications: Class A (/8) for large networks, Class B (/16) for medium networks, and Class C (/24) for local networks, now replaced by CIDR.

### How do I divide a /24 subnet into two smaller networks?

Increase the prefix length by 1 bit to /25. This creates two subnets with 128 total addresses (126 usable hosts) each.

## Related concepts

- **CIDR notation** — Classless Inter-Domain Routing notation, which specifies network prefix length (e.g., /24) to define mask size.
- **Broadcast address** — An IP address used to target all hosts on a subnet simultaneously.
- **Default Gateway** — The router IP that forwards local traffic outside the local subnet.

## Related guides

- [IPv4 Subnetting Basics: CIDR, Masks, and Hosts](https://dothecalculation.com/blog/utility/subnetting-basics) — Learn IPv4 subnetting with a clear /26 example: convert CIDR to a mask, find block boundaries, and calculate network, broadcast, and host ranges.
- [Scientific Notation Guide: Powers of Ten Made Practical](https://dothecalculation.com/blog/math/scientific-notation-basics) — Learn how to convert, compare, and calculate with powers of ten using worked examples and the live DTC scientific calculator.

## Related calculators

- [IP Subnetting & CIDR VLSM Calculator](https://dothecalculation.com/calculators/sub-grid-mask-calculator) — Calculate subnets, CIDR blocks, and Variable Length Subnet Masking host allocations for efficient IP address planning and design.
- [Kubernetes Node & Pod Capacity Planner](https://dothecalculation.com/calculators/k8s-capacity-planner) — Calculate Kubernetes node sizing, cluster utilization margins, and pod allocation scheduling for accurate capacity planning.
- [Cache Hit Rate & CDN Cost Savings Calculator](https://dothecalculation.com/calculators/cache-hit-rate-calculator) — Project origin server load reduction, bandwidth savings, and network cost return on investment when using a CDN, instantly and free.
- [Raft/Paxos Consensus Latency Estimator](https://dothecalculation.com/calculators/distributed-consensus-latency-calculator) — Model consensus commit latencies across distributed nodes under various replication configurations and network locations.
- [Docker Image Layer Size Optimizer](https://dothecalculation.com/calculators/docker-image-optimizer-calculator) — Model Docker container layer sizing, registry storage needs, and deployment transfer time overhead for image optimization planning.
- [Kubernetes HPA Replica Count Simulator](https://dothecalculation.com/calculators/kubernetes-hpa-replica-calculator) — Simulate Kubernetes Horizontal Pod Autoscaler scaling metrics, expected replica counts, and pod resource utilization instantly.

---

_This calculator is for educational and developer planning purposes only. Real-world vector database performance, prompt tokenization, and network routing depend on specific hardware, index configurations, API model updates, and software overlays. Always verify requirements against official documentation before deploying production services._

---

_Source: [Do The Calculation](https://dothecalculation.com/calculators/subnet-calculator). Quote freely with attribution and a link to this page._
