Subnet calculator (IPv4 & IPv6)
Free subnet calculator, subnet mask calculator and CIDR / netmask calculator for IPv4 and IPv6. Enter a prefix such as 192.168.1.0/24 or 2001:db8::/48 to get the network address, subnet mask, wildcard, broadcast, usable host range and address count. Results update as you type.
Try: 192.168.1.0/24 · 10.0.0.0/8 · 172.16.0.0/12 · 2001:db8::/48 · /56 · /64
Result
- CIDR
- 10.0.0.0/20
- Network
- 10.0.0.0
- Netmask
- 255.255.240.0
- Netmask (binary)
- 11111111.11111111.11110000.00000000
- Wildcard
- 0.0.15.255
- Broadcast
- 10.0.15.255
- First usable
- 10.0.0.1
- Last usable
- 10.0.15.254
- Total addresses
- 4,096
- Usable hosts
- 4,094
- Type
- private (RFC 1918)
Subnet size by number of devices
Don’t know the CIDR? Type how many devices (hosts) need an address and get the smallest subnet that fits.
How many subnets do you need?
Need separate networks for staff, guests, cameras or each floor? Type how many, pick the block you have, and get the subnet size and mask.
VLANs: 4 VLANs from a /24 · 10 VLANs · 10 VLANs of 25 devices (needs a /23)
Is this IP in this subnet?
Got an address and a network? Check whether the IP sits inside it — and whether it is a usable host, the network address or the broadcast.
Try: 192.168.1.50 in 192.168.1.0/24 · .255 (broadcast) · 192.168.2.10 (outside) · 2001:db8::5 in /64
Split a network into smaller subnets
Need separate networks for staff, guests and cameras? Enter the big network (e.g. 192.168.10.0/24), pick a size under Split into and press Calculate. You get every smaller network with its usable range and broadcast address. Example: 192.168.10.0/24 split into four /26 networks (62 devices each).
Common subnet masks (/24 to /28)
These are the sizes people look up most often. Click a prefix to calculate it, or open the full subnet mask cheat sheet for every CIDR from /8 to /32 with wildcard masks.
| CIDR | Subnet mask | Usable hosts | Typical use |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | Home / office LAN |
| /25 | 255.255.255.128 | 126 | Half of a /24 |
| /26 | 255.255.255.192 | 62 | Small office / VLAN |
| /27 | 255.255.255.224 | 30 | Small VLAN |
| /28 | 255.255.255.240 | 14 | Point-to-multipoint |
How many hosts per subnet? (devices to mask)
Pick the first row whose usable count is at least the number of devices you need. Every IPv4 subnet loses two addresses (network and broadcast), which is why a /24 holds 254 devices, not 256.
| Devices (up to) | CIDR | Subnet mask | Subnets in a /24 |
|---|---|---|---|
| 2 | /30 | 255.255.255.252 | 64 |
| 6 | /29 | 255.255.255.248 | 32 |
| 14 | /28 | 255.255.255.240 | 16 |
| 30 | /27 | 255.255.255.224 | 8 |
| 62 | /26 | 255.255.255.192 | 4 |
| 126 | /25 | 255.255.255.128 | 2 |
| 254 | /24 | 255.255.255.0 | 1 |
| 510 | /23 | 255.255.254.0 | — |
| 1,022 | /22 | 255.255.252.0 | — |
| 2,046 | /21 | 255.255.248.0 | — |
| 4,094 | /20 | 255.255.240.0 | — |
How many subnets from a /24? (networks to mask)
Each time you double the number of networks, the prefix grows by one and each network halves. Pick the first row with enough networks, then check the devices column is big enough.
| Networks (up to) | CIDR | Subnet mask | Devices each |
|---|---|---|---|
| 2 | /25 | 255.255.255.128 | 126 |
| 4 | /26 | 255.255.255.192 | 62 |
| 8 | /27 | 255.255.255.224 | 30 |
| 16 | /28 | 255.255.255.240 | 14 |
| 32 | /29 | 255.255.255.248 | 6 |
| 64 | /30 | 255.255.255.252 | 2 |
How subnetting works
An IPv4 address is 32 bits, and an IPv6 address is 128 bits. A subnet splits those bits in two: the first n bits (the prefix) identify the network, and the remaining bits identify individual hosts on it. The prefix length after the slash in CIDR notation tells you where the split is. In 192.168.1.0/24, the first 24 bits (192.168.1) are the network, and the last 8 bits give 28 = 256 addresses. For IPv4 the first address is the network address and the last is the broadcast address, so a /24 has 254 usable hosts. Each extra prefix bit halves the subnet, and each bit less doubles it.
IPv4 CIDR cheat sheet (selected prefixes)
| Prefix | Netmask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
Need every row including wildcards and block sizes? Use the subnet mask cheat sheet.
Private ranges and special blocks
The calculator tells you what kind of block you entered. Private ranges (RFC 1918) are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are used inside homes and offices and never routed on the internet. 100.64.0.0/10 is reserved for carrier-grade NAT; if your router’s WAN address is in it, you are behind CGNAT. In IPv6, fc00::/7 is unique local (private), fe80::/10 is link-local and 2000::/3 is global unicast. Read more in public vs private IP addresses.
IPv6 subnet calculator examples
IPv6 subnetting is simpler than IPv4 because addresses are plentiful. Every LAN gets a /64 (required for SLAAC). Your ISP typically delegates a /56 (256 LANs) or a /48 (65,536 LANs). There is no broadcast address in IPv6. Try these documentation prefixes:
2001:db8::/48— site allocation (65,536 × /64)2001:db8::/56— typical home/SMB delegation (256 × /64)2001:db8::/64— one LAN
Need the full list of /64 networks inside a /48 or /56? Use the dedicated IPv6 subnet calculator. New to IPv6? Start with what IPv6 is or check whether your connection has it with the IPv6 test.
Worked IPv4 example
Say you need four networks of up to 60 devices each, carved out of 192.168.10.0/24. 60 hosts plus network and broadcast needs at least 62 addresses, so a /26 (64 addresses, 62 usable) fits. The four /26 networks are 192.168.10.0/26, .64/26, .128/26 and .192/26. Enter 192.168.10.64/26 above and you’ll see hosts .65 to .126 with broadcast .127.
Frequently asked questions
How do I check if an IP address is in a subnet?
Type the IP and the network (for example 192.168.1.50 and 192.168.1.0/24) into “Is this IP in this subnet?”. You get a yes or no, and whether the address is a usable host, the network address or the broadcast. IPv6 works the same way.
What subnet mask do I need for 10 VLANs?
Treat each VLAN as its own network. 10 VLANs from a /24 need 4 extra bits, so you get 16 × /28 (mask 255.255.255.240, 14 devices each) with 6 spare. If each VLAN needs about 25 devices, start from a /23 and use /27s. Type your numbers into “How many subnets do you need?”.
What subnet mask do I need for 50 hosts?
Use a /26 (255.255.255.192). It has 64 addresses and 62 usable for devices, the smallest size that fits 50. For 100 devices use a /25 (126 usable), for 200 use a /24 (254 usable), and for 500 use a /23 (510 usable). Type your number into “Subnet size by number of devices” to get the answer straight away.
How do I work out how many subnets I need?
Count the networks you need (for example staff, guests, cameras and servers is 4), then find the smallest power of 2 that covers it: 2, 4, 8, 16 and so on. Each doubling adds one bit to the prefix. 4 networks from a /24 needs 2 extra bits, so you get 4 × /26 with 62 devices each. 6 networks needs 3 bits (8 × /27, 30 devices each). Type your numbers into “How many subnets do you need?” to get the answer straight away.
Can I fit 10 subnets of 20 devices in a /24?
Yes. 10 networks need 4 extra bits (16 × /28), but a /28 only has 14 usable addresses, so it is too small for 20 devices. Each 20-device network needs a /27 (30 usable), and a /24 holds 8 of those. So 10 × 20 devices does not fit in a /24 with equal sizes; use a /23 (16 × /27) or make some networks smaller.
How many subnets can I get from a /24?
It depends on the size: 2 × /25 (126 devices each), 4 × /26 (62), 8 × /27 (30), 16 × /28 (14), 32 × /29 (6) or 64 × /30 (2). The formula is 2 to the power of the extra prefix bits, so going from /24 to /27 (3 extra bits) gives 2³ = 8 subnets.
How many hosts are in a /24?
A /24 IPv4 subnet has 256 addresses. Two are reserved for the network and broadcast addresses, leaving 254 usable hosts. A /25 has 126 usable, a /26 has 62, a /27 has 30, a /28 has 14, a /29 has 6 and a /30 has 2.
What is a subnet mask calculator?
A subnet mask calculator (or CIDR / netmask calculator) turns a prefix like 192.168.1.0/24 into the network address, subnet mask (255.255.255.0), wildcard, broadcast and usable host range. FernTool does that for IPv4 and IPv6 as you type.
What is CIDR notation?
CIDR notation writes a network as an address followed by a slash and the prefix length, e.g. 192.168.1.0/24. The prefix length is the number of leading bits that identify the network; the remaining bits identify hosts.
How do I split a /24 into smaller subnets?
Pick a size under “Split into” and press Calculate. A /24 (256 addresses) splits into 2 × /25, 4 × /26, 8 × /27, 16 × /28, 32 × /29 or 64 × /30. Each extra bit doubles the number of networks and halves their size, e.g. 192.168.10.0/24 into /26 gives .0, .64, .128 and .192.
What is a subnet mask?
A subnet mask is the prefix length written as an address: /24 is 255.255.255.0, /16 is 255.255.0.0. A wildcard mask is its inverse (0.0.0.255) and is used in router ACLs.
How do I calculate an IPv6 subnet?
Enter an IPv6 prefix such as 2001:db8::/48, /56 or /64. The calculator shows the network, first and last address, total addresses and how many /64 LANs fit inside. Every LAN should be a /64; ISPs usually delegate a /56 or /48 to a site.
Why do /31 and /32 have no broadcast address?
RFC 3021 allows /31 for point-to-point links, where both addresses are usable hosts. A /32 is a single host route. Neither reserves network or broadcast addresses.
What IPv6 subnet size should I use?
Use /64 for every LAN segment: SLAAC address auto-configuration requires it. ISPs typically delegate a /48 or /56 to a site, which contains 65,536 or 256 /64 subnets respectively.
Related: full subnet mask cheat sheet · what is CIDR notation? · IPv6 subnet calculator · public vs private IP · what is CGNAT · IP lookup.
More network tools
- WHOIS lookup (domains, IPs, ASNs)
- DNS lookup (A, AAAA, MX, TXT, NS, CNAME, SOA)
- DNS propagation checker
- SPF, DKIM & DMARC checker (email spoofing)
- SPF record generator
- Is a website down for everyone or just me?
- Where does this link go? (redirect checker)
- Is this website legit? (scam website checker)
- Email header analyzer (is this email real?)
- Reverse DNS (PTR) lookup
- IPv6 subnet calculator (split a /48 or /56 into /64s)
- IP lookup with VPN/Tor/datacenter check
- What is my IP address?
API: GET /api/subnet?cidr=10.0.0.0/22 · MCP tool subnet_calc. Calculations run in your browser and on our server; nothing is stored.