IP Subnet Calculator
IPv4 and IPv6 subnet calculator with CIDR notation, network masks, and host details.
Range: 0 – 32
IP Subnet Calculator — IPv4, IPv6, CIDR, and Network Mask Guide
Internet Protocol (IP) subnetting is the practice of dividing a single physical network into multiple smaller logical sub-networks (subnets). Subnetting is a fundamental concept in networking, used to improve routing efficiency, conserve IP addresses, enhance security, and organize network administration.
This guide covers IP address structures, Classless Inter-Domain Routing (CIDR) notation, IPv4 subnetting calculations, and IPv6 prefix addressing.
---
1. IPv4 Address Structure
An IPv4 address is a 32-bit numerical label assigned to each device connected to a network. It is written in dotted-decimal format, consisting of four octets (8-bit numbers) separated by periods (e.g., `192.168.1.1`).
Every IP address consists of two parts:
- Network ID: Identifies the specific network the device belongs to.
- Host ID: Identifies the unique device on that network.
The boundary between the network portion and the host portion is defined by the Subnet Mask.
---
2. CIDR Notation and Subnet Masks
Traditional classful networking (Classes A, B, and C) was replaced by Classless Inter-Domain Routing (CIDR) in 1993. CIDR uses a slash `/` followed by a number to represent the number of active bits in the subnet mask.
For example, `/24` means the first 24 bits of the 32-bit address are the network portion, and the remaining 8 bits are reserved for hosts.
| CIDR Prefix | Subnet Mask | Usable Host Addresses |
|---|---|---|
| /30 | 255.255.255.252 | 2 |
| /29 | 255.255.255.248 | 6 |
| /28 | 255.255.255.240 | 14 |
| /27 | 255.255.255.224 | 30 |
| /26 | 255.255.255.192 | 62 |
| /25 | 255.255.255.128 | 126 |
| /24 | 255.255.255.0 | 254 |
| /23 | 255.255.254.0 | 510 |
| /22 | 255.255.252.0 | 1,022 |
| /16 | 255.255.0.0 | 65,534 |
| /8 | 255.0.0.0 | 16,777,214 |
---
3. Subnetting Math (IPv4)
When analyzing an IPv4 subnet, there are five key parameters to calculate:
1. Total Hosts
`Total Hosts = 2^(32 - CIDR)`
For a `/24` network, `32 - 24 = 8` host bits. `2^8 = 256` total hosts.
2. Usable Hosts
`Usable Hosts = 2^(32 - CIDR) - 2`
We subtract 2 because the first address is reserved for the Network ID and the last address is reserved for the Broadcast Address.
For a `/24` network: `256 - 2 = 254` usable host addresses.
3. Network Address
The Network Address represents the subnet itself. It is calculated by performing a bitwise AND operation between the IP address and the subnet mask.
4. Broadcast Address
The Broadcast Address allows data to be sent to all hosts on the subnet. It is calculated by turning all host bits to binary `1`s.
5. Usable Host Range
The range of assignable IP addresses for devices, stretching from `Network Address + 1` to `Broadcast Address - 1`.
---
4. IPv6 Subnetting
IPv6 was designed to solve the exhaustion of IPv4 addresses. An IPv6 address is 128 bits long, written in hexadecimal notation as eight groups of four hex digits separated by colons (e.g., `2001:0db8:85a3:0000:0000:8a2e:0370:7334`).
IPv6 subnetting is much simpler because address exhaustion is not a concern:
- The standard subnet size is `/64`, which reserves 64 bits for the network and 64 bits for the host (interface identifier). A single `/64` subnet contains `2^64` addresses (approximately 18 quintillion).
- ISPs typically assign a `/48` or `/56` prefix to homes and businesses, allowing the subscriber to create `65,536` or `256` separate `/64` subnets, respectively.
Related Calculators
- Binary Calculator — Convert and perform math on binary numbers.
- Hex Calculator — Hexadecimal arithmetic and conversions.
- Bandwidth Calculator — Calculate transfer times and speeds.
Frequently Asked Questions
A subnet (subnetwork) is a logical subdivision of an IP network. Dividing a large network into smaller subnets improves performance, organization, and security.
The slash number (/24) represents the number of bits allocated to the network prefix. A prefix of /24 means 24 bits are used for the network, leaving 8 bits for hosts.
A /24 subnet has 8 host bits, yielding 256 total IP addresses. Subtracting 2 (one for the network address, and one for the broadcast address) leaves 254 usable host IPs.
IPv4 uses 32-bit addresses (e.g. 192.168.1.1) and supports 4.3 billion addresses. IPv6 uses 128-bit hexadecimal addresses (e.g. 2001:db8::1), supporting an virtually unlimited address space.
A subnet mask is a 32-bit number that masks an IP address, dividing it into network bits and host bits (e.g., 255.255.255.0 for a /24 subnet).
A wildcard mask is the bitwise inverse of a subnet mask (e.g., 0.0.0.255 for 255.255.255.0). It is used in routers to define address ranges in Access Control Lists (ACLs).