Free developer tool

Subnet Calculator

Enter an IPv4 address and a prefix length such as 24. The calculator returns the network, subnet mask, broadcast address and the range of usable hosts.

What is subnet calculator?

A subnet is a smaller network carved out of a larger one. The prefix length shows how many bits belong to the network part of the address. The rest identify hosts inside it.

Network engineers and developers use subnet math when planning home networks, cloud networks and firewall rules.

How to use the subnet calculator

  1. Enter an IPv4 address.
  2. Enter the prefix length.
  3. Read the network, mask, broadcast and host range.

How the subnet calculator works

The subnet mask has the first N bits set to one. The network address is the IP address AND the mask. The broadcast address is the network address OR the inverted mask. Usable hosts are the total addresses minus two, except for /31 and /32.

Worked example

192.168.1.10/24 gives network 192.168.1.0, mask 255.255.255.0, broadcast 192.168.1.255 and 254 usable hosts from 192.168.1.1 to 192.168.1.254.

Common uses of the subnet calculator

  • Planning home or office networks.
  • Cloud VPC and firewall design.
  • Studying for networking exams.
  • Checking whether two addresses share a subnet.
  • Writing access lists.

Tips and common mistakes

Leave room to grow. A /24 gives 254 hosts, a /23 gives 510.

Private ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

Background: what to know before you rely on it

IPv4 addresses are 32 bit numbers written as four decimal bytes. Early networks used fixed classes A, B and C, which wasted many addresses. In 1993 classless inter domain routing, or CIDR, replaced classes with a flexible prefix length so that blocks could fit real needs. Subnetting lets an organization split one block into many networks, which improves security and reduces broadcast traffic. The rule of subtracting two hosts comes from reserving the first address for the network and the last for the broadcast.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Frequently asked questions

What does /24 mean?

The first 24 bits are the network part, so the mask is 255.255.255.0.

Why minus two hosts?

One address is the network and one is the broadcast.

Does it support IPv6?

Not yet. This tool is for IPv4.

Is the IP sent anywhere?

No. The math runs in your browser.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.