Subnet Calculator
Paste a subnet, a mask, a range or a whole list. Get the network, host range, broadcast and masks for IPv4 and IPv6. Nothing leaves your browser.
- 0
- Subnets
- 0
- Hosts
- 0
- Errors
On this page
About Subnet Calculator
Updated
Subnet Calculator works out everything about an IP subnet: the network address, the first and last usable host, the broadcast address, the subnet mask, the wildcard mask and the number of hosts. It reads IPv4 and IPv6. It is an IP calculator for one subnet or for a list of 200,000, one per line.
Use it as a subnet mask calculator: give a prefix such as /26 and get the mask, or give a mask and get the prefix. As a CIDR calculator, it turns an IP range into CIDR blocks. It also splits a subnet into smaller ones, and merges (summarizes) a list into the fewest blocks.
A typo such as 192.168.1.300 is marked at the bad octet, with how to fix it. Many calculators quietly accept that address and print a wrong answer.
How to use the subnet calculator
- Paste a subnet such as
192.168.1.130/26, or a list, or load a file. This IP subnet calculator checks each line as you type. - Details shows one subnet in full: the network, host range, broadcast, masks, binary and address type. It also gives the reverse zone and reverse name for DNS, and a Cisco ACL line. Click or tap a line in the editor to show that subnet.
- Open Results for a list: each line with its network, host range and hosts, and on a wide screen the wildcard and broadcast. Copy and Download take Results as CSV, with all of these columns.
- Split is the subnetting calculator: it cuts the subnet into equal smaller ones of the size you pick. Merge joins the whole list into the fewest CIDR blocks. For route summarization, it also gives one route that covers all, and how many extra addresses that route takes in.
- Press To network (Alt N; in More on a phone) to rewrite every line as its network in CIDR form.
192.168.1.130/26becomes192.168.1.128/26.
What you can paste
192.168.1.0/24 # CIDR
192.168.1.130/26 # a host
10.0.0.0 255.255.252.0 # mask
10.0.0.0 0.0.3.255 # wildcard
10.0.0.0 - 10.0.3.255 # range
10.0.0.0-10.0.3.255 # range
192.168.1.10 # alone
2001:db8:abcd::/48 # IPv6Each line ends in a comment, so you can paste the whole block into the tool. A host address with a prefix gives the subnet it is in. A range turns into CIDR blocks, with or without spaces around the dash, in IPv4 and IPv6: 2001:db8::-2001:db8::ff is 2001:db8::/120. An address alone gets /24 for IPv4 and /64 for IPv6. Change these sizes in Options.
Blank lines and lines that start with #, // or ; are skipped, so firewall lists, blocklists and cloud IP range files load as they are.
Subnet mask cheat sheet (CIDR chart)
Every IPv4 prefix with its subnet mask, wildcard mask and size. Usable hosts leave out the network and broadcast address, except /31 and /32. On a phone the table shows the prefix, the mask and the usable hosts.
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
IPv6 subnets
IPv6 addresses are 128 bits, written as eight groups of four hex digits. :: stands for one run of zero groups, so 2001:db8:0:0:0:0:0:1 is 2001:db8::1. The tool reads both forms, and an IPv4 tail such as ::ffff:192.0.2.1. It writes every answer in the short form of RFC 5952. For an IPv4-mapped, NAT64, 6to4 or Teredo address, Details shows the IPv4 address inside it.
A LAN is a /64, a home gets a /56, and a site gets a /48. In the Cheat sheet view an IPv6 subnet shows the common sizes and how many /64 networks each holds. A zone such as %eth0 after a link-local address is left out with a note.
Common errors
An octet over 255
Each box below shows a bad line and, as comments under it, the tool's own message. Each of the four numbers in an IPv4 address is one byte, so it goes from 0 to 255.
192.168.1.300/24
# Octet 4 is 300, over 255
# Each of the four numbers goes
# from 0 to 255. Check octet 4:
# did you mean 30?192.168.1.30/24A mask with a gap
A subnet mask is a run of ones, then zeros. A 1 bit after a 0 bit is not a mask.
172.16.0.0 255.0.255.0
# 255.0.255.0 is not a valid mask
# A mask is ones then zeros: no 1
# bit may come after a 0 bit, and
# octet 3 breaks that. Did you
# mean 255.255.0.0 (/16)? A
# wildcard is the other way
# round, such as 0.0.255.255.172.16.0.0 255.255.0.0A prefix that is too big
10.0.0.0/33
# /33 is too big for IPv4
# An IPv4 prefix goes from /0 to
# /32: /32 is one address. For
# IPv6 sizes, write an IPv6
# address.10.0.0.0/24Three octets for a /24
Some tools accept 192.168.1/24 as short for a /24 network. This one asks for all four octets, so the address is never a guess.
192.168.1/24
# 192.168.1 has 3 parts, not 4
# An IPv4 address is four numbers
# from 0 to 255 with dots between
# them, such as 192.168.1.0. For
# a /24 network write
# 192.168.1.0/24.192.168.1.0/24Subnetting and CIDR resources
- RFC 4632: Classless Inter-Domain Routing (CIDR)The standard behind /24 notation, prefix lengths and route summaries.
- RFC 1918: Address Allocation for Private InternetsThe three private IPv4 blocks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
- RFC 3021: Using 31-Bit Prefixes on Point-to-Point LinksWhy a /31 has two usable addresses and no network or broadcast address.
- RFC 4291: IPv6 Addressing ArchitectureIPv6 address forms, prefixes, and the link-local and multicast blocks.
- RFC 5952: A Recommendation for IPv6 Address Text RepresentationThe rules for writing IPv6 short: lower case, no leading zeros, :: once.
- IANA IPv4 Special-Purpose Address RegistryEvery reserved IPv4 block, such as loopback, link-local and documentation ranges.
Subnet calculator FAQ
How do I calculate a subnet mask?
Write the prefix length as that many 1 bits, then fill the rest of the 32 bits with 0. Read the bits as four groups of eight. A /26 is 26 ones and 6 zeros: 11111111., which is 255..
To go from a host count to a mask, add 2 to the hosts you need (the network and broadcast addresses) and round up to a power of two. For 50 hosts: 52 rounds up to 64, which is 6 host bits, so the prefix is 32 - 6 = /26.
How do I convert a subnet mask to CIDR?
Count the 1 bits in the mask. Each octet gives a fixed count: 255 is 8, 254 is 7, 252 is 6, 248 is 5, 240 is 4, 224 is 3, 192 is 2, 128 is 1 and 0 is 0. So 255. is 8 + 8 + 7 + 0 = 23 bits, which is /23.
In this tool, paste the address and the mask, such as 10.. Details shows 10.. The cheat sheet above lists every mask with its prefix.
Is 255.255.255.0 the same as /24?
Yes. 255. has 24 one bits, so it is the mask of a /24. The two forms say the same thing: 192. and 192. are the same network, with 256 addresses and 254 usable hosts.
How many hosts are in a /24, and how many subnets?
A /24 has 256 addresses. Two are the network address and the broadcast address, so 254 are usable hosts.
Cut into smaller subnets, a /24 holds two /25, four /26, eight /27, sixteen /28, thirty-two /29 or sixty-four /30 subnets. Each extra prefix bit doubles the subnets and halves their size. Split in this tool lists them.
What is CIDR notation?
CIDR notation writes a network as its first address, a slash and the prefix length: 10.. The prefix length is the count of network bits. The rest are host bits. CIDR (Classless Inter-Domain Routing) replaced the old classes A, B and C in 1993, so a network can be any size from /0 to /32.
How do I find the IP range of a CIDR block?
The range starts at the network address, where all host bits are 0, and ends at the broadcast address, where all host bits are 1. 192. has 8 host bits, so it runs from 192. to 192.. The usable hosts are 192. to 192..
Paste the block, and Details shows the first and last address, the host range and the count. For IPv6, 2001: runs from 2001: to 2001:.
How do I convert an IP range to CIDR?
Paste the range as two addresses with a dash, for example 192.. The tool turns it into the fewest CIDR blocks that cover it exactly: 192., 192., 192. and 192.. A range that starts and ends on a block edge, such as 10., becomes one block: 10..
How do I check if an IP is in a subnet?
Write the IP with the prefix of the subnet, such as 192., and read the network. Here it is 192.. If that is your subnet, the IP is in it. The rule behind it: an IP is in a subnet when the IP AND the subnet mask gives the network address.
You can also compare with the range. 192. runs from 192. to 192., and 77 is between 64 and 127.
How many IP addresses are in a /31 or a /32?
A /31 has two addresses, and since RFC 3021 both are usable on a point-to-point link between two routers. It has no network or broadcast address. A /32 is one address, used for a single host in a route or a firewall rule. Many older calculators say a /31 has 0 usable hosts; that rule is older than RFC 3021 (December 2000).
What is a wildcard mask?
A wildcard mask is the subnet mask with every bit flipped. The mask 255. becomes the wildcard 0.. Cisco access lists and OSPF use wildcards: a 0 bit must match and a 1 bit can be anything. 10. matches one host. Paste a line with a wildcard and the tool reads it as such.
How do IPv6 subnets work?
IPv6 uses prefix lengths only, never masks. The usual sizes are a /48 for one site, a /56 for a home and a /64 for one LAN. A /64 holds 18,446,744,073,709,551,616 addresses, so you never count hosts; you count /64 networks. A /48 holds 65,536 of them. IPv6 has no broadcast address, so every address in a subnet can go to a host. The first address, with all host bits 0, is also the Subnet-Router anycast address (RFC 4291, section 2.6.1): a packet to it goes to one router on that subnet.
Are my IP addresses sent anywhere?
No. The math runs in your browser, in JavaScript on this page. Your addresses, firewall lists and network plans are never uploaded, stored or logged. The page does not look up your own IP address either. You can load the page, go offline, and it still works.