IPv4 Subnet Calculator

Built and verified by pengchun · Last reviewed · How we verify

Calculate the network, broadcast, usable host range and prefix for any IPv4 address and subnet mask — including dotted masks like 255.255.255.240. Free.

What is an IPv4 Subnet Calculator?

An IPv4 subnet calculator takes an IP address and a prefix length and works out everything about the subnet: the network address, the broadcast address, the subnet mask, and the range of usable host addresses. It is one of the most useful quick tools for anyone setting up a network, writing firewall rules, or planning a VLAN.

Every IPv4 address is 32 bits, and the prefix length tells you how many of those bits belong to the network. The remaining bits identify hosts inside that network. This tool does the binary math for you and shows the results in familiar dotted-decimal form.

How to use the IPv4 Subnet Calculator

  1. Enter an IPv4 address, for example 192.168.1.0.
  2. Enter the prefix length from 0 to 32, for example 24.
  3. Click Calculate Subnet to see the mask, network, broadcast, and usable host range.

Tips

Worked example: 193.24.15.49 with subnet mask 255.255.255.240

Subnetting questions are usually posed with a dotted mask rather than a prefix length, so here is one worked all the way through. You are given the address 193.24.15.49 and the subnet mask 255.255.255.240.

Step 1 — convert the mask to a prefix. The first three octets are all 255, so the first 24 bits are network bits. The last octet, 240, is 11110000 in binary: four more network bits and four host bits. That makes the prefix /28.

Step 2 — find the block size. A /28 leaves 4 host bits, so each subnet holds 2⁴ = 16 addresses. The shortcut gives the same answer: 256 − 240 = 16.

Step 3 — find which block the address sits in. The blocks in the last octet are multiples of 16: 0, 16, 32, 48, 64. The address ends in 49, which falls in the 48 block, so the subnet runs from 193.24.15.48 to 193.24.15.63:

So 193.24.15.49 with mask 255.255.255.240 is a usable host on the 193.24.15.48/28 network. Enter the address above with prefix 28 to confirm every figure.

FAQ

What is a subnet calculator used for?

It splits an IP address and prefix into the network address, broadcast address, subnet mask, and usable host range — everything you need to plan a network or write firewall rules.

What does the /24 in 192.168.1.0/24 mean?

The /24 is the prefix length: the first 24 bits are the network part. 192.168.1.0/24 covers 192.168.1.0 to 192.168.1.255 with 254 usable host addresses.

Why are usable hosts always two fewer than the total?

In every subnet the first address is the network address and the last is the broadcast address, so they cannot be assigned to hosts. /31 and /32 are special point-to-point cases.

How do I convert a subnet mask like 255.255.255.240 into a prefix?

Count the binary 1s in the mask. 255.255.255.240 is 11111111.11111111.11111111.11110000 — 24 ones across the first three octets plus 4 more in the last, so the mask equals /28. Every 255 octet contributes 8, and the remaining octet contributes its own run of leading 1s.

What subnet is 193.24.15.49 with mask 255.255.255.240 in?

That mask is a /28, so the last octet splits into blocks of 16. The address ends in 49, which falls in the 48–63 block, so it belongs to 193.24.15.48/28: network 193.24.15.48, first usable host 193.24.15.49, last usable host 193.24.15.62, broadcast 193.24.15.63, and 14 usable hosts in total.

Related guide: IPv4 Subnetting Explained: Subnet Masks, CIDR, Host Ranges

← Back to all tools