Network security

What Is a Subnet? Subnets, Subnet Masks and CIDR Explained

A subnet is a smaller, separate network carved out of a larger one. Here is how subnet masks and CIDR notation divide address space — and why it matters for security.

Cysoro Security TeamPublished · 7 min read
192.168.10.0 /24 10.1.0.0/16 172.16.0.0/20 10.0.0.0/8 mask 255.255.255.0 NETWORK SECURITY What isa subnet? One network, neatly divided.
Quick answer

A subnet, short for subnetwork, is a smaller network created by dividing a larger IP network into separate segments. Each subnet has its own network address and range of host addresses, defined by a subnet mask or CIDR prefix such as /24. Subnetting lets administrators organize devices, limit broadcast traffic, control routing between groups and isolate sensitive systems behind firewalls.

Key takeaways

  • A subnet is a smaller network carved from a larger one, defined by a subnet mask or CIDR prefix such as /24.
  • The mask splits each IP address into a network part and a host part; /24 means 24 network bits and 254 usable hosts.
  • Subnets improve security by isolating device groups so a breach in one segment cannot freely reach the others.

Every device on your network has an IP address — but an address alone does not say which devices belong together. That is the subnet's job: it draws the boundaries that decide what can talk to what, and what has to go through a router.

What is a subnet?

A subnet, short for subnetwork, is a smaller network created by dividing a larger IP network into separate segments. Each subnet has its own network address and its own range of host addresses.

Think of a large office building divided into floors. The building is the network; each floor is a subnet. People on the same floor can walk to each other's desks directly, but reaching another floor means using the stairs or the lift — the router. In networking, devices in the same subnet talk directly; devices in different subnets send their traffic through a router or gateway.

Subnetting is defined by the address and mask pair. An IPv4 address such as 192.168.10.5 is only half the story: without a subnet mask, a device cannot tell which part of that address is the network and which part is the host. The mask supplies that boundary.

How does subnetting work?

Subnetting works by splitting each 32-bit IPv4 address into two parts: a network prefix and a host identifier. The subnet mask marks the split with 1 bits for the network portion and 0 bits for the host portion.

How a /24 subnet mask splits an address Network part — 192.168.10 Host — .5 192.168.10.5 with mask 255.255.255.0 11111111.11111111.11111111 .00000000 24 one bits = network. 8 zero bits = hosts. 2⁸ = 256 addresses, 254 usable.
A /24 mask splits 192.168.10.5 into network 192.168.10 and host 5. Illustration by Cysoro.

Take the common home network 192.168.1.0/24. The mask 255.255.255.0 is 24 one bits followed by 8 zero bits. The first three octets identify the network, and the last octet identifies the device. Every device from 192.168.1.1 to 192.168.1.254 is on the same subnet and can reach each other directly.

Two addresses in every subnet are reserved. The lowest address is the network address (192.168.1.0), which names the subnet itself. The highest is the broadcast address (192.168.1.255), used to send a message to every device at once. That is why a /24 has 256 addresses but only 254 usable hosts.

What is a subnet mask?

A subnet mask is a 32-bit number that pairs with an IPv4 address to separate the network portion from the host portion. It is written in the same dotted-decimal format as an IP address, such as 255.255.255.0.

Every subnet mask is a run of 1s followed by a run of 0s — never mixed. The 1s mark the network bits; the 0s mark the host bits. The more bits set to 0, the more host addresses are available on that subnet. A mask with 24 network bits leaves room for far fewer devices than one with 16 network bits.

The mask also tells a device how to route. When your computer wants to send a packet, it applies its mask to the destination address. If the network part matches its own, the packet goes directly. If not, it goes to the default gateway — usually your router. That one comparison is the core of IP routing.

What is CIDR notation?

CIDR, or Classless Inter-Domain Routing, is the shorthand for writing a subnet mask as a slash followed by the number of network bits. 192.168.1.0/24 means the same thing as 192.168.1.0 with mask 255.255.255.0.

CIDR replaced the older classful system — Class A, B and C networks with fixed sizes — in the early 1990s. The classful system wasted addresses: a company that needed 300 addresses had to take a Class B block of 65,534. CIDR lets networks be sized precisely, which is documented in RFC 4632. The prefix can range from /0, the entire IPv4 space, to /32, a single address.

Every time the prefix length increases by one, the number of addresses halves. A /23 holds 512 addresses, a /24 holds 256, a /25 holds 128, and so on. That simple halving rule is the fastest way to sanity-check any subnet size.

Common subnet sizes: the table to keep

These are the prefixes you will meet most often, from large office networks down to a point-to-point link. The figures follow the standard reference tables, such as the one in Linuxize's CIDR guide.

CIDRSubnet maskTotal addressesUsable hostsTypical use
/16255.255.0.065,53665,534Large enterprise network
/20255.255.240.04,0964,094Large site or cloud VPC
/24255.255.255.0256254Home and small office LAN
/25255.255.255.128128126Half of a /24
/26255.255.255.1926462Small department or VLAN
/27255.255.255.2243230Small team or IoT segment
/28255.255.255.2401614Tiny segment, e.g. printers
/30255.255.255.25242Point-to-point router link
/32255.255.255.25511A single host route

Notice the pattern: usable hosts are always total addresses minus two, except for /31 and /32, which follow special rules for point-to-point links and single hosts. For everyday subnets from /24 upward, total minus two is the rule to remember.

How do you split a network into subnets?

Splitting a network is a matter of borrowing host bits for the subnet number. Here is the process, using a /24 split into four /26 subnets as the example.

  1. Start with the block: 192.168.10.0/24, 256 addresses, one flat network.
  2. Decide how many subnets you need: four subnets need two borrowed bits, because 2² = 4.
  3. Lengthen the prefix: /24 plus two bits is /26, mask 255.255.255.192.
  4. Work out the ranges: each /26 holds 64 addresses. The four subnets are 192.168.10.0/26 (hosts .1–.62), .64/26 (hosts .65–.126), .128/26 (hosts .129–.190) and .192/26 (hosts .193–.254).
  5. Assign a purpose to each: staff, guests, servers and IoT, for example — then add firewall rules between them.

The same arithmetic works at any size. To find the block size, subtract the changing mask octet from 256: for a /26 the last octet is 192, so each block is 256 − 192 = 64 addresses. That shortcut avoids binary math for most day-to-day subnetting.

Why do subnets matter for security?

Subnets are a security control, not just an addressing convenience. A flat network — every device in one big subnet — means any compromised device can reach every other device directly. Subnets break that up.

Flat network vs segmented network Flat: one subnet • Every device can reach every device • One hacked laptop sees the servers • Broadcast traffic hits everything • No place to put a firewall rule Segmented: four subnets • Staff, guests, servers, IoT separated • A breach stays in its own segment • Firewall rules between segments • Guests never see internal systems
Segmentation contains breaches; a flat network does not. Illustration by Cysoro.
  • Isolation. Put servers, staff, guests and IoT gadgets in separate subnets. A compromised smart TV should never be able to reach your file server.
  • Firewall placement. Traffic between subnets passes through a router or firewall, which is where you enforce rules — guests can reach the internet but not the office LAN.
  • Smaller blast radius. Ransomware spreads fastest on flat networks. Subnets slow lateral movement and buy time to respond.
  • Cleaner monitoring. When traffic is grouped by subnet, unusual flows — such as an IoT device talking to a server — stand out immediately.

This is the same principle behind network segmentation in larger organizations, and it is one of the first things an attack surface review looks at.

Our guide on how to secure your Wi-Fi shows the home version: a separate guest network and an isolated subnet for smart-home devices.

Subnet vs VLAN: what's the difference?

Subnets and VLANs are often confused because they are usually deployed together. They operate at different layers.

A subnet is a Layer 3 division, based on IP addresses and routing. A VLAN (virtual LAN) is a Layer 2 division that separates traffic on a switch, so devices on different VLANs cannot see each other's frames even when they share the same physical switch.

In practice, each VLAN normally gets its own subnet: VLAN 10 might be 192.168.10.0/24 for staff, VLAN 20 might be 192.168.20.0/24 for guests. The VLAN keeps the traffic apart on the wire; the subnet gives each group its own address range and lets the router apply rules between them.

Do subnets work the same way in IPv6?

Mostly, but with simpler math. IPv6 does not use dotted-decimal subnet masks at all — it uses prefix length only, such as /64. A typical home or office gets a /64 per subnet, which holds an effectively unlimited number of addresses, so the host-count arithmetic that matters in IPv4 disappears.

The idea is identical, though: the prefix identifies the network, and the rest identifies the host. If you understand IPv4 subnetting, IPv6 subnetting is the same concept with the numbers moved around.

Common subnetting mistakes

A few errors cause most subnetting headaches. Check for these first when something does not connect.

  • Forgetting the minus two. The network and broadcast addresses are not usable hosts. A /28 holds 14 devices, not 16.
  • Overlapping subnets. Two subnets that share addresses will route unpredictably. Always check new ranges against existing ones.
  • Wrong mask on one device. A device with a /16 mask on a /24 network will think distant addresses are local, and its traffic will never reach the gateway.
  • No gateway configured. Devices in a subnet need a default gateway to reach anything outside it. A missing gateway looks like a broken network.
  • Subnetting too small. A /28 for a department that grows to 20 devices means renumbering later. Leave headroom.

The bottom line

A subnet is simply a smaller network with its own address range, carved out of a larger one with a mask or CIDR prefix. The mask draws the line between network and host, and that line decides what talks directly and what goes through a router.

Learn the /24 and the halving rule, and you can size any subnet in your head. Then use subnets for what they are best at: keeping device groups apart. You can see your own network's public address with our free what-is-my-ip tool.

Frequently asked questions

What is a subnet in simple terms?

A subnet is a smaller network inside a bigger network. Think of a large office building divided into floors: each floor is its own subnet, with its own set of addresses, and traffic between floors goes through a router.

What is the difference between a subnet and a network?

A network is the whole address space, such as 10.0.0.0/8. A subnet is a piece of it, such as 10.1.0.0/24. Every subnet is a network, but not every network is a subnet — the word subnet means it was carved out of something larger.

What does /24 mean?

/24 means the first 24 bits of the 32-bit IPv4 address identify the network, leaving 8 bits for hosts. It is the same as the subnet mask 255.255.255.0, and it holds 256 addresses, 254 of which are usable for devices.

How many hosts are in a /24 subnet?

A /24 has 256 total addresses. Two are reserved — the network address and the broadcast address — leaving 254 usable host addresses.

What is a subnet mask?

A subnet mask is a 32-bit number that tells a device which part of an IP address is the network and which part is the host. In 255.255.255.0, the 1 bits mark the network portion and the 0 bits mark the host portion.

Why do we need subnets?

Subnets organize large networks, reduce broadcast traffic, make routing more efficient and improve security by isolating groups of devices from each other. Without them, every device would sit in one flat network.

Do I need subnets on a home network?

Usually not. A single /24 home network with 254 addresses is plenty. Subnets become useful when you want to isolate smart-home gadgets, guests or a home lab from your main devices.

What is the difference between a subnet and a VLAN?

A subnet is a Layer 3 division based on IP addresses. A VLAN is a Layer 2 division that separates traffic on a switch. They are often used together: each VLAN usually gets its own subnet.

Sources

  1. RFC 4632 — Classless Inter-domain Routing (CIDR)
  2. RFC 791 — Internet Protocol
  3. Linuxize — CIDR Notation and Subnetting Explained
  4. TP-Link — What Is a Subnet Mask and How Does It Work?
  5. UptimeRobot — Subnet Explained: Meaning, Uses & How It Works
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against RFC 4632 (CIDR), RFC 791 and published subnetting guides from Linuxize and TP-Link.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free