IP Subnet Calculator
Enter an IP address with a prefix or subnet mask. This subnet calculator shows the network and broadcast address, usable host range, host count, masks and binary view, for IPv4 and IPv6.
Examples: 192.168.1.130/26, 10.0.0.1 255.255.0.0 or 2001:db8::1/64.
| Network address | | |
|---|---|---|
| CIDR notation | | |
| Broadcast address | | |
| First usable host | | |
| Last usable host | | |
| Usable hosts | | |
| First address | | |
| Last address | | |
| Total addresses | | |
| Subnet mask | | |
| Wildcard mask | | |
| IP class | | |
| Expanded address | | |
| Compressed address | | |
| Hexadecimal | | |
| Integer | |
| # | Subnet | Usable host range | Broadcast |
|---|
Calculate IPv4 and IPv6 Subnets
When you configure a router, a VLAN, a cloud VPC or a server, you need to know exactly which addresses belong to a subnet and which of them you can assign. Type an address with its prefix, such as 192.168.1.130/26, or with a subnet mask, and this subnet calculator shows the network address, broadcast address, first and last usable host and the number of hosts.
You also get the subnet and wildcard masks, the IP class, whether the address is private, public or reserved, and a binary view that shows where the network bits end. IPv6 addresses work too, and you can split any network into equal smaller subnets.
How to use the subnet calculator
- Enter an IP address with a prefix (
10.20.30.40/22) or a subnet mask (10.20.30.40 255.255.252.0). Any address inside the subnet works. - Adjust the prefix length with the slider to see how the network grows or shrinks.
- Read the results: network and broadcast address, usable host range and count, masks and address type. Click Copy next to any value.
- Split the network by entering how many subnets you need, and copy the list.
How subnetting works
An IPv4 address has 32 bits. The prefix length says how many of them identify the network; the rest identify hosts. For 192.168.1.130/26, the first 26 bits are the network and the last 6 bits are for hosts, so the subnet has 26 = 64 addresses.
- Network address: the address with all host bits set to 0 (IP AND mask):
192.168.1.128. - Broadcast address: all host bits set to 1:
192.168.1.191. - Usable hosts: everything in between,
192.168.1.129to192.168.1.190, which is 64 − 2 = 62 hosts. - Subnet mask: 26 ones followed by 6 zeros, written as
255.255.255.192. The wildcard mask is its inverse,0.0.0.63, used in Cisco ACLs and OSPF.
/31 and /32 are special. A /31 has only two addresses; RFC 3021 allows both to be used on point-to-point links, so there is no network or broadcast address and the calculator reports 2 usable hosts. A /32 is a single address with 1 usable host, used for loopbacks and host routes.
IPv6 works the same way with 128 bits, but has no broadcast address, so every address in the range can be assigned. LAN subnets are almost always /64.
IPv4 subnet mask cheat sheet
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts | Typical use |
|---|---|---|---|---|---|
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Large campus or a whole cloud VPC |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | Large VPC or office network |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | Big office or Wi-Fi network |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | Office with up to 510 devices |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | Typical LAN or home network |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | Half a /24, e.g. one floor |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | Small department or VLAN |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | Small office |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | Server or DMZ segment |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | Small block of public IPs |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | Classic point-to-point link |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | Point-to-point link (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | Single host, loopback or host route |
IPv6 prefix sizes
| Prefix | Number of /64 subnets | Addresses | Typical use |
|---|---|---|---|
| /32 | 4,294,967,296 | 296 | Typical allocation to an ISP or large organisation |
| /48 | 65,536 | 280 | Typical assignment to a site or company |
| /56 | 256 | 272 | Common assignment to a home connection |
| /64 | 1 | 264 | One subnet (LAN or VLAN); required for SLAAC |
| /128 | – | 20 | A single interface address |
Subnetting tips
- Plan for growth. Choose a subnet with at least twice the hosts you need today; renumbering later is painful.
- Cloud providers reserve addresses. AWS keeps 5 addresses in every subnet and Azure keeps 5 as well, so a /28 in a VPC gives 11 usable hosts, not 14.
- Use private ranges internally:
10.0.0.0/8,172.16.0.0/12and192.168.0.0/16(RFC 1918). Avoid192.168.0.0/24and192.168.1.0/24for VPN-connected offices, because home routers use them too. - Use /31 for router links to save addresses, if both devices support RFC 3021.
- Subnets of one network never overlap when they are split in powers of two, which is what the split feature does.
Need to turn an address range into CIDR blocks for a firewall, or merge many blocks into one list? Use the CIDR calculator. Setting up the servers too? The chmod calculator helps with file permissions.
Frequently Asked Questions
Common questions about subnets and subnet masks.
A /24 has 256 addresses. The network address (.0) and broadcast address (.255) cannot be assigned, so it has 254 usable hosts.
Apply a bitwise AND to the IP address and the subnet mask. For 192.168.1.130 with 255.255.255.192, the result is 192.168.1.128.
Usable hosts = 2^(32 − prefix) − 2 for prefixes up to /30. A /31 has 2 usable addresses (RFC 3021) and a /32 has 1.
The inverse of the subnet mask: 0 bits where the mask has 1 bits. For 255.255.255.0 it is 0.0.0.255. Cisco access lists and OSPF use wildcard masks.
Yes, on point-to-point links. RFC 3021 lets both addresses of a /31 be used because a link between two routers needs no broadcast address.
They describe the same thing. The prefix /26 counts the 1 bits in the mask; the mask 255.255.255.192 writes the same 26 bits in dotted decimal.
Not for routing: classless routing (CIDR) replaced classes A, B and C in 1993. The class is still shown because it appears in exams and older documentation.
No. IPv6 uses multicast instead, so the first and last addresses of an IPv6 subnet are ordinary addresses. A standard IPv6 subnet is a /64.