# IPv4 Subnetting Basics: CIDR, Masks, and Hosts

Learn IPv4 subnetting with a clear /26 example: convert CIDR to a mask, find block boundaries, and calculate network, broadcast, and host ranges.

---

- **Canonical URL:** https://dothecalculation.com/blog/utility/subnetting-basics
- **Category:** Utilities
- **Author:** Do The Calculation Team
- **Published:** 2026-06-06
- **Last updated:** 2026-06-30
- **Reading time:** 16 min read
- **Publisher:** Do The Calculation (https://dothecalculation.com)
- **Methodology:** https://dothecalculation.com/methodology

---

Given 192.168.1.130/26, can you identify the network without guessing whether the block starts at .0, .64, .128, or .192? Subnetting becomes manageable when you reduce it to three ideas: a 32-bit IPv4 address, a prefix that marks the network bits, and fixed-size address blocks.

This guide focuses on practical IPv4 subnet calculation. It shows how the live DTC Subnet Calculator derives the subnet mask, network address, broadcast address, traditional usable range, and host capacity from four octets and a CIDR prefix.

## Quick Answer: The IPv4 Subnetting Method

- An IPv4 address contains 32 bits, displayed as four decimal octets.
- A /26 prefix uses 26 network bits and leaves 6 host bits.
- Total addresses equal 2 raised to the number of host bits.
- For traditional /0 through /30 subnet sizing, usable hosts equal total addresses minus network and broadcast.
- The network address has every host bit set to 0; the broadcast address has every host bit set to 1.
- The first and last traditional host addresses sit immediately inside those two boundaries.
- Special cases such as /31 point-to-point links require operational context beyond the calculator's traditional usable-host count.

## What IPv4 Subnetting Means

Subnetting divides an address block into smaller prefix-aligned blocks. The prefix determines which leading bits identify the network; the remaining bits identify positions inside that network. Devices use the mask to decide whether a destination is on the local subnet or must be reached through routing.

CIDR notation writes the prefix length after a slash. The address 192.168.1.130/26 means the first 26 bits are the network portion. The dotted-decimal mask for /26 is 255.255.255.192 because the final octet begins with two network bits: 11000000 in binary equals 192.

**Core values for common prefixes inside a /24**
| Prefix | Mask | Host bits | Total addresses | Traditional usable hosts | Last-octet block size |
| --- | --- | --- | --- | --- | --- |
| /24 | 255.255.255.0 | 8 | 256 | 254 | 256 |
| /25 | 255.255.255.128 | 7 | 128 | 126 | 128 |
| /26 | 255.255.255.192 | 6 | 64 | 62 | 64 |
| /27 | 255.255.255.224 | 5 | 32 | 30 | 32 |
| /28 | 255.255.255.240 | 4 | 16 | 14 | 16 |
| /29 | 255.255.255.248 | 3 | 8 | 6 | 8 |
| /30 | 255.255.255.252 | 2 | 4 | 2 | 4 |

## Why Network Boundaries Matter

A correct prefix tells hosts and routers which addresses belong to the same block. It also determines the broadcast boundary and available address capacity under the chosen addressing model. Network design can then place different device groups in different routed or filtered segments.

> **Subnetting is not a security control by itself** — Separate prefixes create routing boundaries, but isolation depends on router, firewall, VLAN, access-control, and host configuration. A subnet plan alone does not prevent traffic between networks.

## Core Subnetting Formulas

**Host bits**

```
Host bits = 32 - CIDR prefix
```
- For /26: 32 - 26 = 6 host bits.

**Address count**

```
Total addresses = 2^(host bits)
```
- For /26: 2^6 = 64 addresses.

**Traditional usable host count**

```
Usable hosts = 2^(host bits) - 2, for prefixes /0 through /30
```
- The subtraction removes the network address and directed-broadcast address.
- /31 and /32 need special handling and are not covered by this traditional formula.

**Boundary calculations**

```
Network = IP AND mask; Broadcast = Network OR inverted mask
```
- Bitwise AND clears the host bits to 0.
- OR with the inverted mask sets the host bits to 1.
- The DTC calculator uses this 32-bit method internally.

## Worked Example: 192.168.1.130/26

_[Figure: Solve a /26 subnet from left to right — The block-size shortcut and bitwise method lead to the same boundaries.]_

### Step 1: Count host bits and addresses

A /26 leaves 6 host bits, so the block contains 2^6 = 64 addresses. Under traditional host counting, 62 are assignable after excluding network and broadcast.

### Step 2: Find the changing octet and block size

The first three mask octets are 255, so the fourth octet controls the boundary. Its mask value is 192. Subtracting from 256 gives a block size of 64. Valid fourth-octet block starts are 0, 64, 128, and 192.

### Step 3: Place the address in its block

The fourth octet 130 is at least 128 and below 192, so its subnet begins at 192.168.1.128. The next block begins at .192, making the current block's final address .191.

**Result for 192.168.1.130/26**
| Field | Result | Reason |
| --- | --- | --- |
| Subnet mask | 255.255.255.192 | 26 leading 1 bits |
| Network address | 192.168.1.128 | First address in the 64-address block |
| Broadcast address | 192.168.1.191 | Last address before the next block |
| First traditional host | 192.168.1.129 | Network plus 1 |
| Last traditional host | 192.168.1.190 | Broadcast minus 1 |
| Traditional usable hosts | 62 | 64 total minus 2 reserved boundaries |

Tool: [Check an IPv4 Subnet](https://dothecalculation.com/calculators/subnet-calculator) — Enter four IPv4 octets and a CIDR prefix to calculate the mask, network, broadcast, traditional host range, and usable-host count.

## Binary Check for the /26 Example

The fourth address octet 130 is 10000010 in binary. The /26 mask's fourth octet is 11000000. Applying AND keeps only the two network bits: 10000000, which equals 128. Setting all six host bits to 1 gives 10111111, which equals 191.

**Fourth-octet bitwise calculation**
| Value | Binary | Decimal |
| --- | --- | --- |
| IP octet | 10000010 | 130 |
| Mask octet | 11000000 | 192 |
| Network after AND | 10000000 | 128 |
| Broadcast with host bits 1 | 10111111 | 191 |

## Prefix Length Trades Capacity for More Networks

_[Figure: Dividing one /24 into equal-size subnets — Longer prefixes produce more blocks but fewer traditional hosts per block.]_

## VLSM: Use Different Prefixes in One Address Plan

Variable Length Subnet Masking assigns different prefix lengths to different needs. Instead of forcing every segment into a /26, a plan might use a /25 for a large device group, a /27 for a smaller group, and /30 blocks for conventional point-to-point links.

- List each required subnet and add realistic growth headroom.
- Choose the smallest prefix that provides the required capacity under the intended addressing rules.
- Allocate the largest block first on a valid boundary.
- Move to the next unused address and allocate the next-largest block.
- Check that every proposed network is prefix-aligned and no ranges overlap.
- Document network, prefix, purpose, gateway convention, reserved addresses, and allocation owner.

## Important /31 and /32 Special Cases

A /31 contains two addresses. RFC 3021 permits both to be used as endpoints on supported IPv4 point-to-point links, where the traditional network and broadcast interpretation is adjusted. A /32 identifies one address and is commonly used as a host route. These are operational special cases, not ordinary multi-access host subnets.

> **DTC calculator behavior for /31 and /32** — The live calculator reports 0 usable hosts for prefixes /31 and /32. It still shows the bitwise network and broadcast boundaries. Do not use its traditional usable-host field to validate an RFC 3021 point-to-point design.

## Common Subnetting Mistakes

- Subtracting the prefix from 32 incorrectly and therefore using the wrong address count.
- Using 256 minus the IP octet instead of 256 minus the mask value in the changing octet.
- Choosing a network address that is not aligned to the prefix block size.
- Assigning the network or broadcast address to a host in a traditional /0–/30 subnet.
- Assuming the “minus two” rule applies unchanged to /31 point-to-point links or /32 routes.
- Designing equal-size subnets when VLSM would match different capacity requirements better.
- Overlapping VLSM ranges because smaller blocks were allocated before larger ones.
- Treating a private-looking address as proof that routing or security is configured correctly.
- Forgetting growth, infrastructure addresses, gateways, high availability, and reserved pools.

## Calculator Limitations and Operational Checks

The DTC tool accepts four numeric octets and a prefix. Its logic rounds and constrains octets to 0–255 and the prefix to 0–32, then performs a 32-bit mask calculation. It does not validate routing tables, VLANs, DHCP exclusions, gateway conventions, address ownership, overlap with other planned subnets, or device support for special cases.

Use the calculator for arithmetic and boundary checks, then validate the design against the actual platform, IP address management system, router and firewall configuration, and applicable standards. IPv6 uses a different planning model and is outside this IPv4 calculator's scope.

## Sources to Verify or Cite

- RFC 4632, Classless Inter-domain Routing (CIDR): https://www.rfc-editor.org/rfc/rfc4632.html
- RFC 1878, Variable Length Subnet Table for IPv4: https://www.rfc-editor.org/rfc/rfc1878.html
- RFC 3021, Using 31-Bit Prefixes on IPv4 Point-to-Point Links: https://www.rfc-editor.org/rfc/rfc3021.html
- Current documentation for the routers, operating systems, cloud networks, and IP address management tools in your environment.

## Frequently Asked Questions

**What does /24 mean?**

/24 means the first 24 of the 32 IPv4 bits are the network prefix. Eight host bits remain, producing 256 total addresses in the block before applying traditional host reservations.

**Is 255.255.255.0 the same as /24?**

Yes. They represent the same contiguous 24-bit subnet mask in dotted-decimal and CIDR prefix notation.

**How do I find the block size quickly?**

In the changing octet, subtract the mask value from 256. For /26, the mask octet is 192, so the block size is 64 and the boundaries occur at multiples of 64.

**Why does a traditional /26 have 62 usable hosts?**

Six host bits provide 64 addresses. In the traditional model, one is the network address and one is the directed-broadcast address, leaving 62 host addresses.

**How many /26 subnets fit inside a /24?**

Four. Extending the prefix from /24 to /26 borrows two bits, and 2^2 equals four equal-size subnets.

**Can an address ending in .0 be a valid host?**

Yes, depending on the prefix. The final octet alone does not determine the role. An address ending in .0 can fall inside a larger or differently aligned subnet; calculate the actual network boundary first.

**Can an address ending in .255 be a valid host?**

Yes, depending on the prefix. It is the broadcast address for many familiar /24 examples, but a different prefix can place it inside a larger block. Use the full address and mask.

**Why does the calculator show zero usable hosts for /31?**

Its usable-host field follows the traditional reservation model and special-cases /31 and /32 as zero. RFC 3021 permits two endpoints on supported point-to-point /31 links, which requires operational context the field does not model.

**What is a /32 used for?**

A /32 identifies one IPv4 address and is commonly represented as a host route. It is not a conventional subnet with a separate network, host range, and broadcast address.

**Does putting devices in different subnets secure them?**

Not by itself. Subnets create routing boundaries. Security depends on the controls applied between and within them, including firewall rules, access lists, VLAN configuration, host controls, and monitoring.

## Final Summary

To solve an IPv4 subnet, translate the prefix into host bits and a mask, calculate the address block size, locate the IP inside a prefix-aligned block, and identify the network and broadcast boundaries. Use the DTC calculator to check the arithmetic, then apply operational rules and special cases from authoritative documentation.

---

_Source: [Do The Calculation](https://dothecalculation.com/blog/utility/subnetting-basics). Quote freely with attribution and a link to this page._
