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.

Examples
subnets
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

Binary (network bits | host bits)
IP
Mask
Net
Subnets

#SubnetUsable host rangeBroadcast
usable hosts each
                    

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.

IP address and prefix turned into a subnet range10.0.0.1/24254 hostsSubnetCalculator

How to use the subnet calculator

  1. 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.
  2. Adjust the prefix length with the slider to see how the network grows or shrinks.
  3. Read the results: network and broadcast address, usable host range and count, masks and address type. Click Copy next to any value.
  4. 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.129 to 192.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

PrefixSubnet maskWildcardAddressesUsable hostsTypical use
/16255.255.0.00.0.255.25565,53665,534Large campus or a whole cloud VPC
/20255.255.240.00.0.15.2554,0964,094Large VPC or office network
/22255.255.252.00.0.3.2551,0241,022Big office or Wi-Fi network
/23255.255.254.00.0.1.255512510Office with up to 510 devices
/24255.255.255.00.0.0.255256254Typical LAN or home network
/25255.255.255.1280.0.0.127128126Half a /24, e.g. one floor
/26255.255.255.1920.0.0.636462Small department or VLAN
/27255.255.255.2240.0.0.313230Small office
/28255.255.255.2400.0.0.151614Server or DMZ segment
/29255.255.255.2480.0.0.786Small block of public IPs
/30255.255.255.2520.0.0.342Classic point-to-point link
/31255.255.255.2540.0.0.122Point-to-point link (RFC 3021)
/32255.255.255.2550.0.0.011Single host, loopback or host route

IPv6 prefix sizes

PrefixNumber of /64 subnetsAddressesTypical use
/324,294,967,296296Typical allocation to an ISP or large organisation
/4865,536280Typical assignment to a site or company
/56256272Common assignment to a home connection
/641264One subnet (LAN or VLAN); required for SLAAC
/128–20A 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/12 and 192.168.0.0/16 (RFC 1918). Avoid 192.168.0.0/24 and 192.168.1.0/24 for 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.