Hosting
Servers
Web Development Pricing
Resources
Get started → Log in
Home/Calculators/Subnet calculator
Free tool · runs in your browser

Subnet calculator
IPv4 CIDR, netmask, host range and subnet splitting.

Type an IPv4 address with a prefix or netmask and get the network, broadcast, usable hosts and masks at once. Nothing is sent anywhere; it all runs on this page.

1. Your IPv4 address and prefix

A slash in the first box wins, then a typed netmask, then the prefix list. A netmask must be a run of ones followed by zeros.

2. Split into subnets

Results

Type an IPv4 address and prefix (for example 192.168.1.10/24) and the results appear here.

What a subnet is

A subnet (subnetwork) is a slice of an IP network. An IPv4 address is 32 bits long, written as four numbers from 0 to 255, such as 192.168.1.10. Part of those 32 bits names the network and the rest names the device on it. Where the split falls is set by the subnet mask or prefix length. Devices in the same subnet can talk to each other directly. To reach another subnet they go through a router.

People subnet to keep networks a sensible size, to separate groups of machines such as servers and guest Wi-Fi, and to hand out address blocks without waste.

CIDR notation

CIDR (Classless Inter-Domain Routing) writes an address and its prefix length together, like 192.168.1.0/24. The number after the slash says how many of the first bits are the network part. In a /24, the first 24 bits are the network and the last 8 bits are for hosts. CIDR replaced the old fixed classes A, B and C. The class shown in the results above is for information only, because routing today uses the prefix, not the class.

Subnet mask and wildcard mask

The subnet mask is the same idea written as an address: ones for the network bits, zeros for the host bits. A /24 is 24 ones then 8 zeros, which is 255.255.255.0. To find the network address, a device does a bitwise AND of the IP and the mask. A valid mask is always ones followed by zeros, so 255.255.0.255 is not a real mask.

The wildcard mask is the mask flipped: zeros for the network bits, ones for the host bits. A /24 has the wildcard 0.0.0.255. Router access lists on some equipment use wildcard masks. The broadcast address is the network address with all the host bits set to one, which is the same as the network address OR the wildcard.

The formula for hosts

With prefix length p, there are 2(32 − p) addresses in the subnet. The first is the network address and the last is the broadcast address, and neither can be given to a normal host. So the usable hosts are:

usable hosts = 2^(32 - p) - 2     (for /30 and shorter)
/31 = 2 usable (RFC 3021)
/32 = 1 (a single host)

For a /24 that is 28 − 2 = 254 usable hosts.

Common prefixes, /8 to /32

PrefixSubnet maskTotal addressesUsable 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 (RFC 3021)
/32255.255.255.25511 (single host)

Private ranges (RFC 1918)

Three blocks are set aside for private networks and are not routed on the public internet:

  • 10.0.0.0/8, from 10.0.0.0 to 10.255.255.255.
  • 172.16.0.0/12, from 172.16.0.0 to 172.31.255.255.
  • 192.168.0.0/16, from 192.168.0.0 to 192.168.255.255.

Home and office networks use these, and a router with NAT lets them reach the internet. Two other ranges are worth knowing. 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598), used by some internet providers. 169.254.0.0/16 is link-local: a device gives itself such an address when it cannot get one from a DHCP server. The tool above labels these, plus loopback (127.0.0.0/8) and multicast (224.0.0.0/4).

Why /31 and /32 are special

By the usual formula a /31 would have 2 − 2 = 0 hosts, which is useless. RFC 3021 changed that for point-to-point links, such as the link between two routers: both addresses are usable and there is no broadcast address. That saves one address per link compared with a /30. A /32 is one address on its own. It is used for a single host route, a loopback address, or to name exactly one machine in a firewall rule.

Worked example: 192.168.1.0/26

  1. The prefix is 26, so 6 bits are left for hosts: 26 = 64 addresses.
  2. The mask is 26 ones then 6 zeros: 255.255.255.192. The wildcard is 0.0.0.63.
  3. The network address is 192.168.1.0 and the broadcast address is 192.168.1.63.
  4. The usable hosts run from 192.168.1.1 to 192.168.1.62, which is 62 hosts (64 − 2).
  5. The next /26 starts at 192.168.1.64, and then .128 and .192. A /24 splits into four /26 subnets. Try it with the split tool above.

Subnets and your server's IP

If you run a server, you meet subnets when you set a firewall rule, a private network or a route. Every RapidServer VPS comes with its own Indian IPv4 address, plus an IPv6 /64, and plans start at ₹581/mo plus 18% GST. Read why a business wants a dedicated IP, or what an IP address is in Hinglish. More free tools are on the calculators page.

Need a server with its own Indian IP?

Every VPS gets a dedicated IPv4 address, in our Mumbai or Delhi data center.

See VPS plans

Frequently asked questions

How do I calculate a subnet?+
Convert the prefix to a mask, then AND the mask with the IP to get the network address. Set all the host bits to one to get the broadcast address. The hosts in between are usable. This calculator does all of it as you type.
How many usable hosts are in a /24?+
254. A /24 has 256 addresses, and the network and broadcast addresses are not usable by hosts. The mask is 255.255.255.0.
What is the difference between a subnet mask and a wildcard mask?+
They are opposites. The subnet mask has ones for the network bits. The wildcard mask has ones for the host bits, so 255.255.255.0 has the wildcard 0.0.0.255.
What does /32 mean?+
It means all 32 bits are the network part, so the subnet is a single address. It is used to point to exactly one host.
Why does a /31 have 2 usable hosts?+
RFC 3021 allows a /31 on point-to-point links. Both addresses are used as hosts and there is no network or broadcast address, so no address is wasted.
Is 192.168.1.1 a private IP address?+
Yes. It sits inside 192.168.0.0/16, one of the three private ranges in RFC 1918. It cannot be reached directly over the public internet.
Does the IP class (A, B, C) still matter?+
Not for routing. Since CIDR, networks are defined by the prefix length, not the class. The class is still shown here because many courses and exams ask for it.
Chat with sales