# IP Subnet Calculator (CIDR)

URL: https://speedycalculator.com/calculators/other/subnet/
Last updated: 2026-10-25

> The subnet calculator gives the number of addresses and usable hosts in an IPv4 network from its CIDR prefix length, along with the subnet mask in dotted-decimal form.

## Inputs

- Prefix length (/n)

## Results

- Total addresses
- Usable hosts
- Mask octet 1
- Mask octet 2
- Mask octet 3
- Mask octet 4

## Formula

```
Addresses = 2^(32 − prefix)
Usable hosts = addresses − 2
```

## Explanation

CIDR notation such as /24 tells you how many bits identify the network; the rest identify hosts.

### How to use the IP Subnet Calculator

- **Prefix length (/n)**

Results update as you type, and every field accepts the units shown in its menu.

### How it works

The host bits determine the number of addresses; the network and broadcast addresses are not usable for hosts.

## Worked example

Inputs — Prefix length (/n): 24.

Results — Total addresses = 256; **Usable hosts = 254**; Mask octet 1 = 255; Mask octet 2 = 255; Mask octet 3 = 255; Mask octet 4 = 0.

## FAQ

**What mask is /24?**
255.255.255.0, with 254 usable hosts.

**Why subtract two?**
The first address names the network and the last is the broadcast address.

**What formula does the IP Subnet Calculator use?**
Addresses = 2^(32 − prefix).

