Free Online Calculator

IP Subnet Calculator

Calculate IPv4 and IPv6 subnets — network and broadcast address, usable host range, masks, class and address type — from an IP address and prefix.

Last updated: Free, no sign-up Private — runs in your browser

IP Subnet Calculator

Enter an address and prefix length (or type it as 192.168.1.10/24) to see the network, broadcast, host range and masks.

You can also enter 192.168.1.10/24 or 192.168.1.10/255.255.255.0.

Quick answer: how to calculate a subnet

AND the IP address with the subnet mask to get the network address; set the host bits to 1 for the broadcast address; usable hosts = 2(32 − prefix) − 2. Example: 192.168.1.10/24 → network 192.168.1.0, broadcast 192.168.1.255, 254 usable hosts.

Overview of the IP Subnet Calculator

The IP Subnet Calculator works out everything about an IP network from an address and a prefix length. For IPv4 it returns the network and broadcast addresses, the first and last usable host, the number of hosts, the subnet and wildcard masks, the IP class and type (private, public, loopback and so on), and the address in binary, integer and hex form. For IPv6 it returns the compressed and expanded address, the network, first and last address in the prefix, and the size of the subnet.

Network engineers, students preparing for networking exams, developers configuring cloud networks (VPCs, security groups) and anyone planning a home or office LAN can use it to check subnet boundaries before configuring routers and firewalls. All calculations run in your browser; the addresses you enter are never sent anywhere.

How We Calculate a Subnet

A subnet mask (or prefix length) tells you which bits of an address identify the network and which identify the host.

  1. Convert the prefix to a mask. A /24 prefix means the first 24 bits are 1s: 255.255.255.0.
  2. Find the network address: bitwise AND the IP address with the mask.
  3. Find the broadcast address: set all host bits to 1 (network address OR wildcard mask, where wildcard = inverted mask).
  4. Find the usable hosts: from network + 1 to broadcast − 1, which is 2(32 − prefix) − 2 addresses. Two special cases: a /31 has 2 usable addresses for point-to-point links (RFC 3021) and a /32 is a single host.
  5. For IPv6, the same idea applies over 128 bits: the network is the address with the host bits set to 0, and the subnet holds 2(128 − prefix) addresses. IPv6 has no broadcast address.
mask = prefix 1-bits followed by (32 − prefix) 0-bits
network = IP AND mask   wildcard = NOT mask
broadcast = network OR wildcard
usable hosts = 2^(32 − prefix) − 2   (/31 → 2, /32 → 1)

Some references list /31 and /32 as having 0 usable hosts; modern practice (RFC 3021) uses them as described above.

IPv4 Subnet Mask Chart (CIDR /8 to /32)

IPv4 prefix sizes, masks and hosts
PrefixSubnet maskTotal addressesUsable hosts
/8255.0.0.01,67,77,2161,67,77,214
/9255.128.0.083,88,60883,88,606
/10255.192.0.041,94,30441,94,302
/11255.224.0.020,97,15220,97,150
/12255.240.0.010,48,57610,48,574
/13255.248.0.05,24,2885,24,286
/14255.252.0.02,62,1442,62,142
/15255.254.0.01,31,0721,31,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

IPv4 Address Classes and Private Ranges

IPv4 address classes (classful addressing)
ClassAddress rangeDefault maskHosts per network
A1.0.0.0 – 126.255.255.255255.0.0.0 (/8)16,777,214
B128.0.0.0 – 191.255.255.255255.255.0.0 (/16)65,534
C192.0.0.0 – 223.255.255.255255.255.255.0 (/24)254
D (multicast)224.0.0.0 – 239.255.255.255——
E (reserved)240.0.0.0 – 255.255.255.255——
Private and special IPv4 ranges
CIDR blockRangeAddresses
10.0.0.0/810.0.0.0 – 10.255.255.25516,777,216
172.16.0.0/12172.16.0.0 – 172.31.255.2551,048,576
192.168.0.0/16192.168.0.0 – 192.168.255.25565,536
100.64.0.0/10100.64.0.0 – 100.127.255.2554,194,304
169.254.0.0/16169.254.0.0 – 169.254.255.25565,536
127.0.0.0/8127.0.0.0 – 127.255.255.25516,777,216

IPv6 Prefix Lengths

Common IPv6 prefix lengths
PrefixTypical useSize
/32Typical allocation to an ISP or large organisation79,228,162,514,264,337,593,543,950,336 (2^96)
/48Typical site (company or home) assignment2^80 addresses — 65,536 /64 subnets
/56Common residential assignment2^72 addresses — 256 /64 subnets
/64Standard single LAN subnet18,446,744,073,709,551,616 (2^64)
/127Router-to-router point-to-point link (RFC 6164)2 addresses
/128A single host address1 address

IP Subnet Calculator — Frequently Asked Questions

What is a subnet mask?

A subnet mask is a 32-bit pattern that separates the network part of an IPv4 address from the host part. 255.255.255.0 means the first 24 bits identify the network and the last 8 bits identify hosts.

What does /24 mean in an IP address?

/24 is CIDR notation for a prefix length of 24 bits — the same as the mask 255.255.255.0. It leaves 8 host bits, giving 256 addresses and 254 usable hosts.

How do I find the network and broadcast address?

AND the IP address with the subnet mask to get the network address. Then set all host bits to 1 to get the broadcast address. For 192.168.1.10/24 the network is 192.168.1.0 and the broadcast is 192.168.1.255.

How many usable hosts are in a subnet?

2^(32 − prefix) − 2, because the network and broadcast addresses cannot be assigned to hosts. A /24 has 254; a /26 has 62; a /30 has 2.

What is a wildcard mask?

The inverse of the subnet mask (each bit flipped). The wildcard for 255.255.255.0 is 0.0.0.255. It is used in router access lists and OSPF configuration.

What is the difference between a public and a private IP address?

Private addresses (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) are used inside local networks and are not routed on the public internet. Public addresses are globally unique and reachable over the internet.

What is CIDR notation?

Classless Inter-Domain Routing writes an address with its prefix length, such as 203.0.113.0/24. It replaced fixed classes A, B and C and lets networks be sized exactly.

Why do /31 and /32 have special rules?

A /31 has only two addresses and is used for point-to-point links (RFC 3021); a /32 identifies a single host, such as a loopback or a specific route.

How does IPv6 subnetting differ from IPv4?

IPv6 addresses are 128 bits, written in hexadecimal. There is no broadcast address, and the standard LAN subnet is a /64 containing 2^64 addresses. Prefix length works the same way as in IPv4.

What is the :: in an IPv6 address?

It is shorthand for one or more consecutive groups of zeros and can appear only once. 2001:db8::1 is the same as 2001:0db8:0000:0000:0000:0000:0000:0001.

Is the address I enter sent to a server?

No. The Websolindia IP Subnet Calculator runs entirely in your browser; nothing you type is uploaded or stored.

Need a custom calculator or tool on your website?

Our team designs and develops fast, SEO-ready websites and web tools. Tell us what you need.

Call Us WhatsApp

Get a Free Quote

Tell us a bit about your project — we'll get back to you shortly.

5 + 5 =
Call WhatsApp