Subnet Calculator
Calculate IPv4 and CIDR subnets, host ranges, netmasks, broadcast addresses, and binary bit masks.
Runs in your browser. Nothing you add is uploaded.
What the Subnet Calculator does
Give this calculator an IPv4 address and a prefix length and it shows the subnet the address belongs to: the network and broadcast addresses, the first and last address you can assign to a device, the subnet mask and its wildcard (inverse) mask, how many hosts fit, and a bit-by-bit view of where the network part ends. Switch to IPv6 and it does the same for 128-bit prefixes, including how many /64 networks fit inside a /48 or /56. You can paste an address with its prefix attached, such as 10.20.30.40/22, and it is split into the two fields for you.
How to calculate a subnet
- Choose IPv4 or IPv6 at the top.
- Type or paste an address. If you paste it with a prefix (192.168.10.77/26), the prefix field updates too.
- Pick the prefix length. Each option in the list shows its dotted subnet mask, so you can also choose by mask.
- Read the network address, usable host range, broadcast address, wildcard mask and host count. Every value has its own copy button.
- Use the binary breakdown to see which bits are network and which are host, or press Apply in the reference table to try another common size.
The Subnet Calculator runs entirely in your browser — nothing you enter is uploaded, stored, or logged.
How it works
Network, broadcast and usable hosts
network = address AND mask
broadcast = network OR (NOT mask)
usable = 2^(32 − prefix) − 2The mask is prefix 1-bits followed by 0-bits. ANDing it with any address in the subnet clears the host bits and gives the network address; setting every host bit gives the broadcast address. Hosts are everything in between. /31 and /32 are special cases with 2 and 1 usable addresses.
Example: 192.168.10.77/26: mask 255.255.255.192, network 192.168.10.64, broadcast 192.168.10.127, usable 192.168.10.65–192.168.10.126 (2^6 − 2 = 62 hosts), wildcard 0.0.0.63.
When to use it
Splitting an office network
A /24 gives 254 usable addresses. Splitting it into four /26 subnets, say staff, guests, printers and cameras, gives four ranges of 62 hosts: .1–.62, .65–.126, .129–.190 and .193–.254. Entering any address shows the boundaries of its range, which is the quickest way to check that a device's static IP really sits inside the subnet you meant.
Planning cloud VPC ranges
AWS, Azure and Google Cloud ask for CIDR blocks when you create a VPC and its subnets, and ranges that overlap cannot be peered or joined by VPN later. Working the blocks out first, for example 10.0.0.0/16 for the VPC with /20 or /24 subnets inside it, avoids that. Cloud providers also reserve a few addresses in every subnet (AWS and Azure reserve five), so their usable count is lower than the standard figure shown here.
Firewall rules and ACLs
Cisco access lists and OSPF network statements take a wildcard mask, the inverse of the subnet mask: 0.0.0.63 for a /26, 0.0.15.255 for a /20. The calculator shows the wildcard next to the mask, so there is no need to subtract each octet from 255 by hand and risk an ACL that matches too much.
Good to know
- For prefixes up to /30, usable hosts = 2^(32 − prefix) − 2: the first address names the network and the last is the broadcast address.
- A /31 is shown with 2 usable addresses and a /32 with 1. Point-to-point /31 links (RFC 3021) have no network or broadcast address, and a /32 is a single host.
- The scope label recognises the RFC 1918 private ranges (10/8, 172.16/12, 192.168/16), loopback (127/8) and link-local (169.254/16). Other special ranges, such as 100.64.0.0/10 used for carrier-grade NAT, are labelled public.
- The reverse DNS value is the PTR name of the exact address you entered (its octets reversed under in-addr.arpa), not the zone for the whole subnet.
- The IP class (A, B, C) is shown for reference only. Routing has been classless since 1993, so the prefix length, not the class, decides how big a network is.
Frequently asked questions
What is the difference between network address and broadcast address?
Why do /31 and /32 subnets behave differently?
How do I find the network address by hand?
What are the RFC 1918 private address ranges?
How many /64 subnets are in a /48?
Page last updated . Found a wrong result or a mistake on this page? Let us know.
Related tools
HTTP Status Code Lookup
Look up any HTTP status code: meaning, causes and how to fix it.
HTTP Header Analyzer
Paste HTTP headers to see what each means and what to fix.
HTTP Header Generator
Generate security, CORS, cache and CSP headers for your server.
User-Agent Parser
Identify the browser, OS, device or bot behind a User-Agent.