How to use the subnet calculator
- Type an IPv4 address with a prefix such as 192.168.1.10/24, or with a subnet mask such as 192.168.1.10 255.255.255.0. You can also type the address alone and pick the prefix from the list. IPv6 works the same way: 2001:db8::1/64.
- Read the results: the network address, subnet mask and wildcard mask, the broadcast address, the first and last usable host, how many hosts fit, the address type (private, public, loopback and so on) and the reverse DNS zone.
- Check whether another address belongs to the network, or split the network into smaller subnets and download the list in a CSV file.
- Switch to VLSM plan to fit several subnets of different sizes into one network, or to Range to CIDR to turn a first and last address into the fewest CIDR blocks, for a firewall rule or an allow list.
How subnetting works
An IPv4 address is 32 bits, written in four numbers from 0 to 255. The prefix length says how many of those bits, counted from the left, name the network; the rest number the hosts inside it. A /24 keeps 24 network bits and leaves 8 host bits, so it holds 28 = 256 addresses. The subnet mask is the same idea written like an address: 24 ones followed by 8 zeros is 255.255.255.0.
To find the network an address belongs to, the computer does a bitwise AND of the address and the mask, which clears the host bits. Setting every host bit to 1 instead gives the broadcast address, the last one in the subnet. In IPv4 those two addresses are not given to hosts, which is why a /24 has 254 usable hosts and not 256. The calculator shows the address in binary with the network bits and host bits in different colours, so you can see where the line falls.
CIDR (Classless Inter-Domain Routing, RFC 4632) replaced the old class A, B and C networks in 1993, so a prefix can be any length from /0 to /32. The class is still shown because some exams and older equipment refer to it, but it no longer decides the size of a network.
IPv4 subnet mask cheat sheet
Every prefix from /8 to /32, with its mask, wildcard mask, the number of addresses and the usable hosts:
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /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 |
Private, public and special addresses
Some ranges are set aside and never routed on the public internet. The calculator names the range an address falls in, from the IANA special-purpose address registries:
- Private networks (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, used behind a router with NAT. In IPv6 the equivalent is unique local addresses, fc00::/7 (RFC 4193).
- Carrier-grade NAT (RFC 6598): 100.64.0.0/10, used by internet providers between their network and your router.
- Loopback: 127.0.0.0/8 and ::1, which always mean this computer.
- Link-local: 169.254.0.0/16, which a computer gives itself when no DHCP server answers, and fe80::/10 in IPv6, present on every IPv6 interface.
- Documentation: 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (RFC 5737), and 2001:db8::/32 and 3fff::/20 for IPv6, for examples that will never clash with a real network.
- Multicast: 224.0.0.0/4 and ff00::/8, for one-to-many traffic such as video streams and routing protocols.
/30, /31 and /32
A link between two routers needs only two addresses. Traditionally it used a /30: four addresses, two of them usable. RFC 3021 allows a /31 on point-to-point links, where the network and broadcast addresses are not needed, so both addresses go to the routers and half the space is saved. A /32 is a single address, used for loopback interfaces and host routes. The calculator follows these rules, so a /31 shows two usable hosts and no broadcast address.
Subnetting IPv6
An IPv6 address is 128 bits, written in eight groups of four hexadecimal digits. The calculator writes it the standard short way (RFC 5952): leading zeros dropped, the longest run of zero groups replaced by ::, and lower case. It also shows the full expanded form. IPv6 has no broadcast address, so every address in a subnet is usable.
Almost every IPv6 LAN is a /64, because address autoconfiguration needs a 64-bit interface identifier. A provider usually gives a site a /48 or a /56, which you then cut into /64s: a /48 holds 65,536 of them and a /56 holds 256. The /64 subnets row shows that number for any prefix shorter than /64. Hexadecimal makes the split easy to read, because each digit is 4 bits: a /52, /56 or /60 boundary always falls on a whole digit.
Planning subnets with VLSM
With fixed-length subnetting every subnet has the same size, so a two-host router link takes the same room that a 60-host office does. VLSM sizes each subnet to fit. The calculator sorts your subnets from largest to smallest and gives each one the smallest block that holds its hosts plus the network and broadcast addresses, one after another from the start of the network. Taking the largest first keeps every block on a boundary of its own size, which routers require, and leaves the free space in one piece at the end.
For example, 192.168.10.0/24 with Sales (60 hosts), Engineering (28), Guest Wi-Fi (12), Printers (5) and a router link (2) becomes a /26, a /27, a /28, a /29 and a /30, using 124 of the 256 addresses and leaving 192.168.10.124/30, 192.168.10.128/25 free for later.
From an address range to CIDR
Firewalls, cloud security groups and allow lists usually take CIDR blocks, not ranges. A range that does not start and end on a block boundary needs several blocks: 192.168.1.10 to 192.168.1.100 is 91 addresses and becomes 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/28, 192.168.1.32/27, 192.168.1.64/27, 192.168.1.96/30 and 192.168.1.100/32. The calculator finds the fewest blocks that cover the range exactly, for IPv4 or IPv6.
Wildcard masks and reverse DNS
The wildcard mask is the subnet mask inverted. Cisco routers use it in access lists and OSPF network statements, and some firewalls ask for it too. The reverse DNS zone is the name under in-addr.arpa (IPv4) or ip6.arpa (IPv6) where the PTR records for the network live. Zones follow whole octets in IPv4 and whole hex digits in IPv6, so a /22 needs four /24 zones, and a network smaller than a /24 shares its /24 zone through classless delegation (RFC 2317).
Privacy
The calculator works entirely in your browser: addresses are never sent to a server. Your last inputs are saved in your browser’s local storage so they are there next time, and Copy a link puts the address after a # in the link, a part that browsers never send to a server. To find your own public address, use What Is My IP.
Frequently asked questions
How do I find the network address from an IP address and subnet mask?
Write both in binary and keep only the bits where the mask has a 1 (a bitwise AND). For 192.168.1.10 with 255.255.255.0 the last octet is cleared, so the network is 192.168.1.0. Setting all the host bits to 1 instead gives the broadcast address, 192.168.1.255.
How many usable hosts are in a /24, /27 or /30?
A subnet of prefix /n has 2 to the power (32 − n) addresses, and two of them are the network and broadcast addresses. So a /24 has 256 addresses and 254 usable hosts, a /27 has 32 and 30, and a /30 has 4 and 2. A /31 is the exception: on a point-to-point link both of its addresses are usable (RFC 3021).
What is a wildcard mask?
The subnet mask with every bit flipped: 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF network statements use it, with 0 meaning “this bit must match” and 1 meaning “any value”. Each octet of the wildcard is 255 minus the same octet of the mask.
What are the private IP address ranges?
RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16 for private networks. They are never routed on the internet, so a router uses NAT to share one public address. 100.64.0.0/10 is a separate shared range that internet providers use for carrier-grade NAT (RFC 6598).
Why is an IPv6 subnet usually a /64?
IPv6 addresses split into a 64-bit network prefix and a 64-bit interface identifier, and stateless address autoconfiguration (SLAAC) only works with a /64. A /64 holds 18,446,744,073,709,551,616 addresses, so the question in IPv6 is how many subnets you need, not how many hosts. A site usually receives a /48 or /56, which is 65,536 or 256 subnets of /64.
What is VLSM?
Variable Length Subnet Masking gives each subnet the smallest block that fits it instead of making every subnet the same size. You list the subnets with their host counts, sort them largest first, and give each one the next free block of the right size: 60 hosts get a /26 (62 usable), 25 hosts a /27 (30 usable), and a point-to-point link a /30.
Does this subnet calculator send my IP addresses anywhere?
No. Every result is worked out by the page in your browser, and nothing you type is sent to a server. Your last inputs are kept only in your own browser, so they are there when you come back.