What Is a Subnet? A Beginner's Guide
Key takeaways
- A subnet groups addresses under a common network prefix.
- A subnet mask or prefix length identifies which part of an IPv4 address belongs to the network.
- Devices normally use a router or gateway to reach other subnets.
- Separate subnets help organize access policies, but policies still need to be configured.
On this page
A subnet, short for subnetwork, is a logical part of an IP network identified by a shared network prefix. In everyday network planning, it is a way to organize devices into separate address ranges.
For example, an office might place employee computers, guest devices, and printers in different subnets. Each group has its own range, and routing and access rules determine how the groups communicate.
What does a subnet look like?
A subnet is commonly written as an address followed by a slash and a number:
192.168.10.0/24
Here, 192.168.10.0 identifies the network, and /24 is its prefix length. This subnet contains the 256 addresses from 192.168.10.0 through 192.168.10.255.
A laptop might use 192.168.10.20 within that range. The subnet describes the group; the laptop’s address identifies its connection within it. If addresses are unfamiliar, start with What Is an IP Address?.
What is a subnet mask?
An IPv4 subnet mask marks the network part of an address. The remaining bits identify positions within that network.
For a /24 network, the mask is 255.255.255.0. In this particular case, the first three numbers identify the network portion, while the final number varies within it:
| Setting | Example |
|---|---|
| Device address | 192.168.10.20 |
| Subnet mask | 255.255.255.0 |
| Equivalent prefix length | /24 |
| Network address | 192.168.10.0 |
| Typical gateway address, if configured this way | 192.168.10.1 |
The relationship between masks, network prefixes, and prefix lengths is explained in RFC 1812. Other prefix lengths can split an address within one of its dotted numbers, so the first-three-numbers shortcut applies to /24, not every subnet.
For a guide to reading the slash notation, see What Is CIDR Notation?.
How do devices communicate within and between subnets?
On a typical office LAN using 192.168.10.0/24, a laptop at 192.168.10.20 treats a computer at 192.168.10.30 as a local destination. It normally sends traffic directly across that local network.
A printer at 192.168.30.50 is outside that subnet. To reach it, the laptop normally sends the traffic to a router, often through its default gateway. The router needs a route to the printer’s network, and applicable access rules must permit the connection.
A default gateway is a router used for destinations without a more specific route. Its address is not always the first usable address in the subnet; that is a configuration choice.
Changing only the laptop’s subnet mask does not create a route or configure the rest of the network. Devices and routers need a consistent addressing plan.
Why divide a network into subnets?
Subnets make a larger network easier to organize. Consider this example plan:
| Group | Subnet | Intended access policy |
|---|---|---|
| Employee computers | 192.168.10.0/24 | Reach approved business systems and printers |
| Guest devices | 192.168.20.0/24 | Reach the internet, with access to internal systems blocked |
| Printers | 192.168.30.0/24 | Accept approved printing and management traffic |
This is a proposed policy, not behavior created automatically by the address ranges. A router or firewall must enforce the rules.
Separating groups can also make troubleshooting clearer: an administrator can identify which part of the network an address belongs to and investigate the appropriate gateway and policies.
Cloud networks use subnets in a similar organizational role. AWS’s subnet documentation describes placing resources in defined address ranges and using network access controls to govern traffic.
How many devices fit in a subnet?
The number of addresses and the number available for devices are different.
In a conventional IPv4 /24 subnet, there are 256 total addresses. The network address and broadcast address are normally unavailable for ordinary host assignments, leaving 254. Routers and other infrastructure may use some of those remaining addresses.
Managed platforms can reserve additional addresses. For example, AWS VPC reserves the first four and last IPv4 addresses in ordinary subnet allocations, leaving 251 out of a /24 before resources consume addresses. AWS documents separate behavior for BYOIP ranges.
There are also protocol exceptions to the usual network-and-broadcast rule: RFC 3021 allows both addresses in an IPv4 /31 to be used on a point-to-point link. Always distinguish total block size from usable capacity in your environment.
Is a subnet public or private?
An address range and a subnet’s connectivity are related but separate decisions.
Private IPv4 ranges are not globally routable. Their devices can still access public services through an appropriate gateway, often using NAT.
Cloud terminology can add another distinction. In AWS, a public subnet has a direct route to an internet gateway. That label alone does not give every resource a public address or permit every connection; the address assignment, routing, and security settings also matter. See AWS’s subnet types.
Read Public vs Private IP Addresses for the underlying address categories.
Does IPv6 use subnets?
Yes. IPv6 networks also use prefixes to organize address space. A common prefix length for an ordinary IPv6 LAN is /64, as discussed in RFC 7421.
An illustrative subnet is 2001:db8:10:1::/64. The 2001:db8::/32 range is reserved for documentation, so this is an example rather than an address range to deploy publicly.
IPv6 planning uses a much larger address space and different allocation practices. Avoid treating it simply as IPv4 with longer addresses. Our IPv4 vs IPv6 comparison explains the broader differences.
FAQ
Related resources
Ready to see where BYOIP is supported?
Continue the series
What Is CIDR Notation? IP Address Ranges Explained
Understand the slash in an IP range, calculate how many addresses a block contains, and recognize the difference between total and usable addresses.
5 min read · Updated 10 September 2026
Read articleWhat Is NAT, and How Does It Work?
Follow two devices through a NAT gateway to see how address translation works, why ports matter, and what NAT does and does not provide.
6 min read · Updated 10 September 2026
Read article