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.
IP address (binary)
Show the calculation
Segments are placed largest first. The smallest network is a /30 with 2 hosts. This tab never assigns a /31 or /32, because they have no network or broadcast address.
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.
| CIDR | Subnet mask | Usable hosts | Typical use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Very large networks (ISPs, corporations) |
| /16 | 255.255.0.0 | 65,534 | Medium-sized company networks |
| /24 | 255.255.255.0 | 254 | Home networks, small offices |
| /26 | 255.255.255.192 | 62 | A /24 split into quarters |
| /28 | 255.255.255.240 | 14 | Small network segments |
| /30 | 255.255.255.252 | 2 | Point-to-point links |
| /31 | 255.255.255.254 | 2 | Point-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.
- 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. - 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. - Set all host bits to 1. That gives you the broadcast address
192.168.10.127. - Everything in between is usable:
192.168.10.65to192.168.10.126, so 26 − 2 = 62 hosts.
| Decimal | Binary | |
|---|---|---|
| IP address | 192.168.10.77 | 11000000.10101000.00001010.01001101 |
| Subnet mask /26 | 255.255.255.192 | 11111111.11111111.11111111.11000000 |
| Network address | 192.168.10.64 | 11000000.10101000.00001010.01000000 |
| Broadcast | 192.168.10.127 | 11000000.10101000.00001010.01111111 |
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:
| Subnet | Network | Usable range | Broadcast | Hosts |
|---|---|---|---|---|
| 1 | 192.168.0.0/26 | 192.168.0.1 – 192.168.0.62 | 192.168.0.63 | 62 |
| 2 | 192.168.0.64/26 | 192.168.0.65 – 192.168.0.126 | 192.168.0.127 | 62 |
| 3 | 192.168.0.128/26 | 192.168.0.129 – 192.168.0.190 | 192.168.0.191 | 62 |
| 4 | 192.168.0.192/26 | 192.168.0.193 – 192.168.0.254 | 192.168.0.255 | 62 |
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:
| Segment | Needed | Network | Usable hosts | Range |
|---|---|---|---|---|
| LAN A | 100 | 192.168.0.0/25 | 126 | 192.168.0.1 – 192.168.0.126 |
| LAN B | 50 | 192.168.0.128/26 | 62 | 192.168.0.129 – 192.168.0.190 |
| LAN C | 10 | 192.168.0.192/28 | 14 | 192.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:
| Range | Addresses | Used for |
|---|---|---|
| 192.168.0.1 | 1 address | Router / gateway |
| 192.168.0.2 – .19 | 18 addresses | Network infrastructure (switches, access points) |
| 192.168.0.20 – .99 | 80 addresses | Servers & fixed devices (Pi, NAS, printer) |
| 192.168.0.100 – .199 | 100 addresses | DHCP pool for phones and laptops |
| 192.168.0.200 – .254 | 55 addresses | IoT 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/24for 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. With255.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
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.
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).
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.
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.
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.
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.
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.
