Subnet Calculator: IPv4 Networks, Masks and Host Ranges

This subnet calculator (also known as a CIDR calculator) takes an IPv4 address and prefix and shows you the network address, broadcast address, usable host range and more. It has three tabs: “Calculate network” gives you the details for one address, including the calculation steps, “Split network” divides a network into equal subnets, and “VLSM” divides it into subnets sized to what each one needs.

🌐 Subnet Calculator
⚠️ That doesn’t look like a valid IPv4 address or prefix. Use the format x.x.x.x (e.g. 192.168.1.0) and a prefix from 1 to 32.
254usable hosts
–Network address
–Broadcast address
–First usable IP
–Last usable IP
–Wildcard mask
–CIDR notation
–Total addresses
–Subnet mask
Mask bits (32)

IP address (binary)

Show the calculation

What is a subnet?

A subnet is a smaller network carved out of a larger IP network. An IPv4 address has 32 bits, written as four octets with values from 0 to 255. The first bits identify the network, the rest identify the devices (hosts) in it, and the subnet mask sets where that boundary is.

Splitting a network this way (subnetting) keeps things organized, lets you control which devices can reach each other and keeps broadcasts inside each subnet.

Understanding CIDR notation

CIDR notation (Classless Inter-Domain Routing, RFC 4632) writes the subnet mask as a number after a slash. /24, for example, means the first 24 bits of the address identify the network, which is the same as the subnet mask 255.255.255.0.

CIDRSubnet maskUsable hostsTypical use
/8255.0.0.016,777,214Very large networks (ISPs, corporations)
/16255.255.0.065,534Medium-sized company networks
/24255.255.255.0254Home networks, small offices
/26255.255.255.19262A /24 split into quarters
/28255.255.255.24014Small network segments
/30255.255.255.2522Point-to-point links
/31255.255.255.2542Point-to-point links per RFC 3021, not supported everywhere

Calculating the network and broadcast address by hand

Take 192.168.10.77/26 as an example. The /26 prefix means the first 26 bits belong to the network and the last 6 bits to the hosts.

  1. Write the IP address and the subnet mask in binary, one above the other. /26 gives 26 ones and 6 zeros, which is 255.255.255.192.
  2. Apply a bitwise AND: where the mask has a 1, the IP bit stays; where it has a 0, the result is 0. That gives you the network address 192.168.10.64.
  3. Set all host bits to 1. That gives you the broadcast address 192.168.10.127.
  4. Everything in between is usable: 192.168.10.65 to 192.168.10.126, so 26 − 2 = 62 hosts.
DecimalBinary
IP address192.168.10.7711000000.10101000.00001010.01001101
Subnet mask /26255.255.255.19211111111.11111111.11111111.11000000
Network address192.168.10.6411000000.10101000.00001010.01000000
Broadcast192.168.10.12711000000.10101000.00001010.01111111
Finding the network address of 192.168.10.77/26NetworkHost part: 6 bitsIP address192.168.10.01001101= 77Mask /26255.255.255.11000000= 192Network (AND)192.168.10.01000000= 64Broadcast192.168.10.01111111= 127Boundary after bit 26
Only the fourth octet changes. The two network bits stay as they are, and the six host bits are all 0 for the network address and all 1 for the broadcast address.

There’s a faster shortcut: the block size, which is 256 minus the first mask octet that isn’t 255. For 255.255.255.192 that’s 256 − 192 = 64. In that octet (the fourth one here), the subnets start at .0, .64, .128 and .192, and .77 falls into the one starting at .64. For your own address, “Show the calculation” in the calculator runs through the same steps.

Splitting a network into subnets

Every bit you add to the prefix cuts the network in half. One extra bit turns a /24 into two /25s, two bits give you four /26s, three bits eight /27s. That’s why the number of subnets is always a power of two: if you need six, you get eight.

Here’s 192.168.0.0/24 split into four subnets:

SubnetNetworkUsable rangeBroadcastHosts
1192.168.0.0/26192.168.0.1 – 192.168.0.62192.168.0.6362
2192.168.0.64/26192.168.0.65 – 192.168.0.126192.168.0.12762
3192.168.0.128/26192.168.0.129 – 192.168.0.190192.168.0.19162
4192.168.0.192/26192.168.0.193 – 192.168.0.254192.168.0.25562

You can split by the number of networks you need or by the number of devices each one has to hold. The “Split network” tab handles both.

At home you’ll rarely need this. Splitting pays off when the address space is fixed and tight, for example in a company network, a lab or an exam question.

Subnets of different sizes (VLSM)

Equal-sized subnets waste addresses when your segments differ a lot in size. VLSM (Variable Length Subnet Masking) gives each segment only as much room as it needs. You assign from the largest segment to the smallest, giving each one the smallest prefix that fits its hosts plus the network and broadcast address.

Example: splitting 192.168.0.0/24 for three segments with 100, 50 and 10 devices:

SegmentNeededNetworkUsable hostsRange
LAN A100192.168.0.0/25126192.168.0.1 – 192.168.0.126
LAN B50192.168.0.128/2662192.168.0.129 – 192.168.0.190
LAN C10192.168.0.192/2814192.168.0.193 – 192.168.0.206

That leaves 192.168.0.208/28 and 192.168.0.224/27 free, 48 addresses for later segments. With four equal /26 networks, the segment with 100 devices wouldn’t even have fit. The “VLSM” tab in the calculator does this for any set of segments.

Private IP address ranges

RFC 1918 reserves three address ranges for local networks. They are not routed on the public internet:

  • 10.0.0.0/8: 16,777,216 addresses
  • 172.16.0.0/12: 1,048,576 addresses (172.16.0.0 to 172.31.255.255)
  • 192.168.0.0/16: 65,536 addresses, the range most home routers use

Planning your home network

Most home networks run on the router’s default setup: one network where every device can see every other device.

Which network should you use at home?

192.168.0.0/24 and 192.168.1.0/24 are the most common router defaults (FRITZ!Box routers, common in Germany, use 192.168.178.0/24), and 254 hosts are plenty for almost any household. If you plan to split your network later, treat 192.168.0.0/16 as your address space and give each segment its own /24, as shown under “Separating devices with subnets”.

Assigning fixed IP addresses

Devices you always need to reach, such as a Raspberry Pi, a NAS, printers or cameras, should keep the same IP address. There are two ways to do that:

  • DHCP reservation on the router (recommended): the router always hands the same IP to a specific MAC address. Nothing to configure on the device itself.
  • Static IP on the device: you set it in the device’s own network configuration. It doesn’t depend on the router, but you have to keep track of it yourself. On the Pi, this is covered in setting a static IP address on the Raspberry Pi.

This layout works well for 192.168.0.0/24:

RangeAddressesUsed for
192.168.0.11 addressRouter / gateway
192.168.0.2 – .1918 addressesNetwork infrastructure (switches, access points)
192.168.0.20 – .9980 addressesServers & fixed devices (Pi, NAS, printer)
192.168.0.100 – .199100 addressesDHCP pool for phones and laptops
192.168.0.200 – .25455 addressesIoT devices, smart home, cameras

Separating devices with subnets

With a router or firewall that supports VLANs (OpenWrt, MikroTik, UniFi or OPNsense, for example), you can move groups of devices into their own subnets:

  • Isolate IoT devices: smart bulbs, plugs and cameras go into their own network (192.168.10.0/24) and, with the right firewall rules on the router, can’t reach your PCs or NAS.
  • Keep guests separate: 192.168.20.0/24 for guests, with internet access but no access to your home network. Many consumer routers offer this as a built-in guest network, no VLAN setup needed.
  • Server network: Raspberry Pis, home servers and the NAS in 192.168.30.0/24.

Don’t forget gateway and DNS

Every subnet has two addresses you need to get right. The gateway (usually .1, your router) forwards traffic to the internet, and the DNS server turns domain names into IP addresses. On a home network, a Raspberry Pi makes a good local DNS server with Pi-hole: it blocks ads for every device on the network and shows you which DNS queries your devices send.

Common IP addressing mistakes

  • IP conflict: two devices end up with the same IP. This happens when you assign static addresses from inside the DHCP pool. Fix: limit the DHCP pool to .100–.199 and pick static addresses outside it.
  • Wrong gateway or DNS server: the device has an IP address but still can’t get online.
  • Wrong subnet mask: for 192.168.0.50 in a /24 network, the mask has to be 255.255.255.0. With 255.255.0.0, the device still reaches its neighbors, but it treats all of 192.168.x.x as local and tries to reach other subnets directly instead of going through the gateway.

Subnet FAQ

What’s the difference between a subnet mask and CIDR notation?

They describe the same thing in two different ways. The subnet mask 255.255.255.0 is the same as the CIDR prefix /24: the number tells you how many of the 32 bits in an IPv4 address belong to the network. CIDR is shorter and is what you’ll see almost everywhere today.

Why does a /24 have only 254 usable hosts instead of 256?

In a regular subnet, two addresses are reserved: the network address (the first IP, e.g. 192.168.0.0) and the broadcast address (the last IP, e.g. 192.168.0.255). That leaves 256 – 2 = 254 usable addresses in a /24. The exceptions are /31 (point-to-point links, both addresses usable) and /32 (a single host).

Which subnet should I use for a home network?

For a typical home network, a /24 (255.255.255.0) with 254 usable hosts is more than enough. If you later want separate segments for IoT devices or guests, give each one its own /24, such as 192.168.10.0/24 and 192.168.20.0/24.

What is the broadcast address used for?

The broadcast address is the last IP in a subnet (e.g. 192.168.0.255 in a /24; a /31 or /32 has none). A packet sent to it reaches every device in that subnet. Wake-on-LAN magic packets, for example, are often sent there. ARP and DHCP rely on broadcasts too, but they use the Ethernet broadcast or the address 255.255.255.255 instead.

How do I split a /24 into 4 subnets?

Four subnets need 2 extra prefix bits (2² = 4), so the /24 becomes a /26. The four networks start at .0, .64, .128 and .192, and each has 62 usable hosts. In the calculator, use the “Split network” tab.

How do I work out the network address without a calculator?

Write the IP address and subnet mask in binary, one above the other, and combine them with a bitwise AND: where the mask has a 1, the IP bit stays, otherwise it becomes 0. The block size is quicker: 256 minus the first mask octet that isn’t 255. For a /26 that’s 64, so 192.168.10.77 is in the 192.168.10.64 network.

What is VLSM?

VLSM (Variable Length Subnet Masking) splits a network into subnets of different sizes instead of equal ones. You assign from the largest segment to the smallest, and each one gets the smallest prefix that fits its hosts plus the network and broadcast address. That leaves more address space for later.

Bottom line

For your Raspberry Pi, set up a DHCP reservation on the router so it’s always reachable at the same address. Not sure which address your Pi has right now? Here’s how to find your Raspberry Pi’s IP address.