Skip to content
Calculator.hair

IP Subnet Calculator

IPv4 Subnet Calculator

Network Class

Class A allows /8 and longer, B /16 and longer, C /24 and longer.

Press Calculate to see the results.

IPv6 Subnet Calculator

Press Calculate to see the results.

Enter an IP address and choose a subnet mask or prefix length. The IP subnet calculator returns the network and broadcast addresses, usable host range and every common representation of the address.

An IPv4 address is a 32-bit number, written as four decimal octets such as 192.168.1.10. Every address has two parts: a network portion that identifies the subnet and a host portion that identifies a device on it. The subnet mask, or its shorthand prefix length in CIDR notation, says where the split falls. In 192.168.1.10/24 the first 24 bits (192.168.1) are the network and the last 8 bits are the host, so the subnet holds 256 addresses from 192.168.1.0 to 192.168.1.255.

Two addresses in each ordinary subnet are reserved. The lowest, with all host bits zero, is the network address that names the subnet itself; the highest, with all host bits one, is the broadcast address that reaches every host on it. A /24 therefore has 254 usable host addresses. Point-to-point links may use /31 subnets with two usable addresses and no broadcast, as RFC 3021 allows, and a /32 identifies a single host.

To find the network address, perform a bitwise AND between the IP address and the mask. The wildcard mask, used in router access lists, is the mask with every bit inverted. Each extra bit of prefix halves the number of addresses in the subnet: a /25 holds 128 addresses and a /26 holds 64.

PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/9255.128.0.08,388,6088,388,606
/10255.192.0.04,194,3044,194,302
/11255.224.0.02,097,1522,097,150
/12255.240.0.01,048,5761,048,574
/13255.248.0.0524,288524,286
/14255.252.0.0262,144262,142
/15255.254.0.0131,072131,070
/16255.255.0.065,53665,534
/17255.255.128.032,76832,766
/18255.255.192.016,38416,382
/19255.255.224.08,1928,190
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Before 1993, IPv4 addresses were handed out in fixed classes. A class A network (first octet 1 to 126) had an 8-bit network prefix and room for about 16.7 million hosts, class B (128 to 191) a 16-bit prefix and 65,534 hosts, and class C (192 to 223) a 24-bit prefix and 254 hosts. Classes D and E were set aside for multicast and experimental use. Classful allocation wasted addresses, so Classless Inter-Domain Routing (CIDR) replaced it with prefixes of any length, and the class of an address now matters mainly for history and some older equipment.

Some ranges are reserved for private networks by RFC 1918 and never appear on the public internet; home routers use them behind network address translation (NAT). Other special ranges include 127.0.0.0/8 for loopback, 169.254.0.0/16 for automatic link-local addressing and 100.64.0.0/10 for carrier-grade NAT.

Private rangeCIDR blockAddresses
10.0.0.0 – 10.255.255.25510.0.0.0/816,777,216
172.16.0.0 – 172.31.255.255172.16.0.0/121,048,576
192.168.0.0 – 192.168.255.255192.168.0.0/1665,536

IPv6 was designed because the roughly 4.3 billion IPv4 addresses ran out; the regional registries exhausted their free pools between 2011 and 2019. An IPv6 address is 128 bits long, written as eight groups of four hexadecimal digits separated by colons. Leading zeros in a group can be dropped, and one run of all-zero groups can be replaced with a double colon, so 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1.

IPv6 has no broadcast addresses and no classes. Subnetting works the same way, with a prefix length from /1 to /128, but the scale is very different. The standard subnet for a local network is a /64, which leaves 64 bits, about 18 quintillion addresses, for hosts so that devices can configure their own addresses automatically. Internet providers typically assign a /48 or /56 to each site, giving it 65,536 or 256 separate /64 subnets.

The block 2001:db8::/32 used in the default example is reserved for documentation and will never be routed on the internet.

IPv6 prefixTypical useNumber of /64 subnets
/32Allocation to an internet provider4,294,967,296
/48A business site65,536
/56A home connection256
/64A single LAN or VLAN1
/128A single interface or loopback—

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 contains 256 addresses, minus the network and broadcast addresses.

What is the subnet mask for /27?

255.255.255.224. It contains 32 addresses, 30 of them usable.

How do I find the network address?

AND each octet of the IP address with the corresponding octet of the subnet mask. For 192.168.1.130/26 the network is 192.168.1.128.

What is a wildcard mask?

The inverse of the subnet mask, used in router access control lists. For 255.255.255.0 it is 0.0.0.255.

Why is a /64 the standard IPv6 subnet?

Stateless address autoconfiguration (SLAAC) builds a host's address from a 64-bit interface identifier, so a LAN needs 64 host bits.

Updated by Calculator.hair. How we build and check our calculators