Calculators

Subnet Calculator

Calculate network ranges, masks, broadcast addresses and host counts for IPv4 and IPv6 CIDR blocks.

What is subnet calculator?

A subnet divides a network into smaller ranges. Enter an address with its prefix length to see the masks, the network and broadcast addresses, and how many hosts the subnet can hold.

How to use this tool

  1. Enter an address and prefix and review any options.
  2. Select Calculate to submit your request.
  3. Read the result, inspect its source and copy or download the response if needed.

Understanding the results

Network
The first address of the block, written with its prefix, such as 192.168.1.0/24.
Subnet mask and wildcard mask
The prefix written as a mask (255.255.255.0 for a /24) and its inverse (0.0.0.255).
Broadcast address
The last address of an IPv4 subnet, used to reach every host on it at once.
First and last usable address
The range you can assign to devices.
Usable host count
Total addresses minus the network and broadcast addresses. /31 and /32 blocks are the exceptions.

Supported features and common uses

IPv4 results include subnet and wildcard masks, broadcast address and conventional usable host counts, which exclude the network and broadcast addresses. /31 point-to-point and /32 host routes are handled separately. IPv6 results show the prefix and complete numeric address range. Calculations use integer arithmetic on the server without contacting the entered address.

Troubleshooting

Check the address format and prefix. IPv4 prefixes range from 0 to 32; IPv6 prefixes range from 0 to 128.

How subnetting works

An IPv4 address is 32 bits long. The prefix length, the number after the slash, says how many of those bits identify the network. The remaining bits identify hosts inside it. In 192.168.1.0/24, the first 24 bits are the network and the last 8 are free for hosts, which gives 256 addresses.

Each bit you add to the prefix halves the subnet. A /25 has 128 addresses and a /26 has 64. Each bit you remove doubles it, so a /23 has 512.

Common IPv4 subnet sizes

  • /30: 4 addresses, 2 usable, mask 255.255.255.252. Used for links between two routers.
  • /29: 8 addresses, 6 usable, mask 255.255.255.248.
  • /28: 16 addresses, 14 usable, mask 255.255.255.240.
  • /27: 32 addresses, 30 usable, mask 255.255.255.224.
  • /26: 64 addresses, 62 usable, mask 255.255.255.192.
  • /25: 128 addresses, 126 usable, mask 255.255.255.128.
  • /24: 256 addresses, 254 usable, mask 255.255.255.0.
  • /23: 512 addresses, 510 usable, mask 255.255.254.0.
  • /22: 1,024 addresses, 1,022 usable, mask 255.255.252.0.
  • /16: 65,536 addresses, 65,534 usable, mask 255.255.0.0.

Why two addresses are reserved

In a normal IPv4 subnet, the first address names the network itself and the last is the broadcast address, which reaches every host on the subnet at once. Neither can be given to a device, so the usable count is the total minus two.

Two prefix lengths are exceptions. A /31 has only two addresses, and on a link between two routers both can be used. A /32 is a single address, used for one host in routing tables and firewall rules.

Planning a network

Size each subnet for the devices you expect, with room to grow. Running out of addresses later means renumbering, which is far more work than leaving space now. Keep each subnet on its natural boundary. A /24 splits cleanly into four /26 blocks that start at .0, .64, .128 and .192.

Cloud platforms keep a few addresses for themselves. AWS and Azure each reserve five in every subnet, so a /28 gives you 11 addresses to work with there, not 14.

Private address ranges

Three ranges are reserved for private networks and never appear on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Home routers typically use 192.168.0.0/24 or 192.168.1.0/24. A fourth range, 100.64.0.0/10, is reserved for internet providers to share between customers.

If two networks will ever be joined by a VPN, give them ranges that do not overlap. Two offices that both use 192.168.1.0/24 cannot route to each other without address translation.

IPv6 subnets

IPv6 addresses are 128 bits long and work on the same principle, with a few differences. There is no broadcast address. The standard size for a single network is a /64, whatever the number of devices, and a site usually receives a /48 or a /56 to divide into /64 subnets. Counting hosts matters much less, because a /64 holds more addresses than any network will use.

Where wildcard masks are used

A wildcard mask is the subnet mask with every bit flipped. A 0 bit means the address must match and a 1 bit means it can be anything. Cisco access lists and OSPF network statements use this form, so 192.168.1.0 with a wildcard of 0.0.0.255 matches the whole /24.

A worked example

Enter 192.168.10.130/26. A /26 has 64 addresses, so the blocks in this range start at 0, 64, 128 and 192. The address 130 falls in the third block. The calculator reports the network as 192.168.10.128/26, the mask as 255.255.255.192 and the broadcast address as 192.168.10.191. The usable range runs from 192.168.10.129 to 192.168.10.190, which is 62 hosts.

The same steps work for any prefix. Find the block size, find which block the address falls in, and the rest follows.

Choosing a subnet size

  • Count the devices that need an address today, including printers, phones, access points and servers.
  • Add room for growth. Doubling the count is a reasonable rule for an office.
  • Add two for the network and broadcast addresses.
  • Pick the smallest prefix whose total is at least that number.

For 40 devices today, plan for 80, add two and you need 82 addresses. A /26 has only 64, so the answer is a /25 with 128.

Terms used on this page

  • Prefix length: the number after the slash, counting the network bits.
  • Subnet mask: the same boundary written as four numbers.
  • Network address: the first address in the subnet.
  • Broadcast address: the last address in an IPv4 subnet.
  • Usable hosts: the addresses left for devices.
  • Gateway: the router address that devices use to reach other networks, usually the first or last usable address.

Frequently asked questions

Good questions. Clear answers.
How many usable hosts are in a /24?

254. A /24 contains 256 addresses, and conventional IPv4 subnets reserve the first as the network address and the last as the broadcast address.

What is a wildcard mask?

The inverse of the subnet mask, used in some router access lists and routing configuration. For a /24 it is 0.0.0.255.

Can I enter a private address?

Yes. Private addresses are valid for subnet planning, and the calculator never contacts the address you enter.

What is the difference between a subnet mask and a prefix length?

They carry the same information in two notations. A prefix length of /24 and a mask of 255.255.255.0 both say that the first 24 bits identify the network.

How do I work out which subnet an address is in?

Enter the address with its prefix length, such as 192.168.1.77/26. The network field shows the subnet it falls in, here 192.168.1.64/26.

How many hosts fit in a /28?

14. A /28 has 16 addresses, and the network and broadcast addresses are reserved.

What subnet do I need for 50 devices?

A /26, which has 62 usable addresses. A /27 has only 30.

Why can’t I use the first and last address?

The first identifies the network and the last is the broadcast address. Most systems refuse to assign either to a device.

What is a /32?

A single IPv4 address. It appears in routing tables and firewall rules when a rule should apply to exactly one host.

Is the subnet calculator the same as the CIDR calculator?

They share the arithmetic. This page is built around planning a subnet and reports usable hosts and the broadcast address. The CIDR calculator converts a block into its range and exact address count.

Which address should the router use?

Any usable address works. By convention the gateway takes the first usable address, such as .1 in a /24, or the last.

Does subnetting make a network faster?

It can. Smaller subnets mean fewer devices receive each broadcast, and they let you place firewall rules between groups of devices.

Can a subnet be larger than a /24?

Yes. A /23 or /22 puts 510 or 1,022 hosts in one subnet. Very large subnets carry a lot of broadcast traffic, so most networks stay at /24 or smaller.

Do IPv6 subnets have a broadcast address?

No. IPv6 uses multicast for the jobs that broadcast does in IPv4.

What is the mask for a /20?

255.255.240.0. A /20 holds 4,096 addresses, of which 4,094 are usable.