Subnet (CIDR) Calculator
Instantly calculate subnet details from any IPv4 CIDR notation β network address, broadcast address, subnet mask, first and last usable host, and total host count.
- Network Address
- 192.168.1.0
- Broadcast Address
- 192.168.1.255
- Subnet Mask
- 255.255.255.0
- Wildcard Mask
- 0.0.0.255
- First Usable Host
- 192.168.1.1
- Last Usable Host
- 192.168.1.254
- Usable Hosts
- 254
- Total Addresses
- 256
- IP Class
- C
- Address Type
- Private (RFC 1918)
Subnet Mask (binary)
11111111.11111111.11111111.00000000
Host Range
192.168.1.1 β 192.168.1.254
Quick Reference
| Prefix | Mask | Usable Hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 |
Quick answer
A subnet calculator takes an IPv4 address and a CIDR prefix length (e.g., 192.168.1.0/24) and computes the network address, broadcast address, subnet mask, first usable host, last usable host, and total usable host count. The number of usable hosts equals 2^(32βprefix) β 2 for prefixes /1 through /30. For example, a /24 network has 256 total addresses and 254 usable hosts. Subnetting lets network engineers divide a large IP space into smaller, manageable segments for routing and security isolation.
Formula & method
Subnet Mask = 2^32 β 2^(32βprefix) (as a 32-bit integer)
- prefix β CIDR prefix length, e.g. 24 for /24
Set the top 'prefix' bits to 1 and the remaining bits to 0 to form the mask.
Network Address = IP & Mask
- IP β 32-bit integer representation of the IPv4 address
- Mask β 32-bit subnet mask derived from the prefix
Bitwise AND of the host IP and the subnet mask zeros out the host portion.
Broadcast = Network | (~Mask)
- Network β Network address (host bits all zero)
- ~Mask β Bitwise complement of the subnet mask (wildcard mask)
Bitwise OR of the network address and the inverted mask sets all host bits to 1.
Usable Hosts = 2^(32 β prefix) β 2
- prefix β CIDR prefix length
Subtract 2 to exclude the network address and broadcast address. For /31 and /32 special rules apply (RFC 3021).
Examples
- Input
- IP: 192.168.1.0, Prefix: /24
- Result
- Network: 192.168.1.0 | Broadcast: 192.168.1.255 | Mask: 255.255.255.0 | Hosts: 192.168.1.1 β 192.168.1.254 | Usable: 254
- Why
- A /24 prefix keeps 24 bits for the network and 8 bits for hosts. Total addresses = 2^8 = 256. Usable hosts = 256 β 2 = 254 (excluding network .0 and broadcast .255).
- Input
- IP: 10.0.0.0, Prefix: /8
- Result
- Network: 10.0.0.0 | Broadcast: 10.255.255.255 | Mask: 255.0.0.0 | Hosts: 10.0.0.1 β 10.255.255.254 | Usable: 16,777,214
- Why
- A /8 prefix leaves 24 host bits. Total addresses = 2^24 = 16,777,216. Usable hosts = 16,777,216 β 2 = 16,777,214, covering the entire 10.x.x.x RFC 1918 private range.
- Input
- IP: 172.16.5.100, Prefix: /20
- Result
- Network: 172.16.0.0 | Broadcast: 172.16.15.255 | Mask: 255.255.240.0 | Hosts: 172.16.0.1 β 172.16.15.254 | Usable: 4,094
- Why
- The /20 mask has 12 host bits. Total = 2^12 = 4,096. Usable = 4,094. The host IP 172.16.5.100 falls inside this subnet; the network address is 172.16.0.0 (the bottom 12 bits are zeroed).
- Input
- IP: 203.0.113.64, Prefix: /26
- Result
- Network: 203.0.113.64 | Broadcast: 203.0.113.127 | Mask: 255.255.255.192 | Hosts: 203.0.113.65 β 203.0.113.126 | Usable: 62
- Why
- A /26 leaves 6 host bits. Total = 2^6 = 64. Usable = 62. The third octet of the mask is 192 (binary 11000000). This is a common block size used for branch office uplinks.
Frequently asked questions
What does CIDR notation mean?
CIDR stands for Classless Inter-Domain Routing. The notation 192.168.1.0/24 means the first 24 bits of the address identify the network and the remaining 8 bits identify individual hosts within that network. It replaced the older Class A/B/C system to allow more flexible IP allocation.
Why are 2 addresses always subtracted for usable hosts?
The first address in any subnet (all host bits = 0) is the network address used for routing, and the last address (all host bits = 1) is the broadcast address. Neither can be assigned to a device, so usable hosts = total addresses β 2. The exception is /31 (point-to-point links, RFC 3021) and /32 (single host).
What is a wildcard mask and how does it differ from a subnet mask?
A wildcard mask is the bitwise complement of the subnet mask. Where the subnet mask has 1s (network bits), the wildcard has 0s, and vice versa. Wildcard masks are used in Cisco ACLs and OSPF network statements to specify which bits must match.
How many subnets can I create from a /24 network using /26?
A /26 adds 2 bits beyond the /24 boundary, creating 2^2 = 4 subnets. Each /26 subnet has 64 addresses and 62 usable hosts. The four blocks are .0/26, .64/26, .128/26, and .192/26.
What are the RFC 1918 private IP ranges?
RFC 1918 defines three private, non-routable IPv4 ranges: 10.0.0.0/8 (16.7 million addresses), 172.16.0.0/12 (1 million addresses, covering 172.16.0.0 through 172.31.255.255), and 192.168.0.0/16 (65,536 addresses). These are used inside LANs and are translated to public IPs by NAT at the internet edge.
What is a /32 subnet used for?
A /32 prefix identifies exactly one host address β there is no network or broadcast address. It is used for loopback interfaces, host routes in routing tables, and in firewall rules to match a single IP. The 'subnet' contains only that one address with no usable range.
Sources & references
- https://www.rfc-editor.org/rfc/rfc4632
- https://www.rfc-editor.org/rfc/rfc1918
- https://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml
External references open in a new tab. We are independent and not affiliated with these organizations.
- β Free to use
- β No sign-up required
- β Runs entirely in your browser β nothing is uploaded.
- β Formula and method shown above
Provided βas isβ for general information only β results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
- Haversine Distance CalculatorDeveloper
- GPS Coordinate FinderGeography & Maps
- Prime Number CheckerCalculators
- LCM & GCD CalculatorCalculators
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the subnet (cidr) calculator to appear: