Home
My IP
GPS
Find Me
Your Location
4๏ธโƒฃIPv4: โ€”
๐Ÿ“...
6๏ธโƒฃIPv6: โ€”
๐ŸŒ...
๐Ÿข...
๐Ÿ“Œ...
How-To Guides10 min read

Subnet Calculator Guide: CIDR Notation and Subnetting

From CIDR notation to usable hosts: subnetting explained with worked /24, /27, and /30 examples you can follow.

By WhatIsMyLocation TeamยทUpdated July 1, 2026
Subnet Calculator Guide: CIDR Notation and Subnetting

Summarise this article with:

The One-Minute Version

A subnet is a slice of an IP address block, defined by how many bits belong to the network vs. the hosts. Write it as a prefix length after a slash: 192.168.1.0/24 means 24 bits are network, 8 bits are hosts. That gives 2^8 = 256 total addresses, minus 2 reserved (network and broadcast), leaving 254 usable host addresses. Every other prefix length follows the same formula. Use Subnet Calculator to get the full breakdown instantly, or read on to understand the math yourself.

The subnet calculator does the CIDR math for you
The subnet calculator does the CIDR math for you

Why Subnetting Exists

In the early internet, IP addresses were allocated using a classful system:

ClassRangeDefault MaskHosts per Network
A1.0.0.0 - 126.255.255.255/8 (255.0.0.0)16,777,214
B128.0.0.0 - 191.255.255.255/16 (255.255.0.0)65,534
C192.0.0.0 - 223.255.255.255/24 (255.255.255.0)254

This system was wasteful. An organization needing 300 addresses received a Class B allocation (65,534 addresses), wasting over 65,000. Subnetting, formalized as CIDR (Classless Inter-Domain Routing) in the early 1990s, solved this by letting administrators carve networks into right-sized segments, regardless of class boundaries.

Understanding IP Addresses and Subnet Masks

An IPv4 address is a 32-bit number written as four decimal octets. The subnet mask is also 32 bits and divides the address into two parts: the network portion (contiguous 1s) and the host portion (contiguous 0s).

IP Address:    192.168.1.100    = 11000000.10101000.00000001.01100100
Subnet Mask:   255.255.255.0    = 11111111.11111111.11111111.00000000
                                   |------ network ------|-- host --|

A bitwise AND of the IP address and the mask gives the network address:

11000000.10101000.00000001.01100100  (192.168.1.100)
AND
11111111.11111111.11111111.00000000  (255.255.255.0)
=
11000000.10101000.00000001.00000000  (192.168.1.0  โ† network address)

CIDR notation compresses the mask to a single number: the count of network bits. 192.168.1.0/24 means 24 bits are network bits (mask = 255.255.255.0).

The Subnetting Workflow

Every subnet calculation follows the same four steps:

  1. Count host bits - host bits = 32 minus the prefix length
  2. Calculate total addresses - 2^(host bits)
  3. Calculate usable hosts - total addresses minus 2 (one for the network address, one for the broadcast address)
  4. Identify the range - network address, first usable, last usable, broadcast

That four-step loop handles any prefix. The next three sections run it on /24, /27, and /30.

Worked Example: /24

Scenario: You are setting up a typical office LAN at 192.168.10.0/24.

StepCalculationResult
Host bits32 - 248
Total addresses2^8256
Usable hosts256 - 2254
Network address-192.168.10.0
First usable-192.168.10.1
Last usable-192.168.10.254
Broadcast-192.168.10.255

The subnet mask in dotted notation is 255.255.255.0. With 254 usable addresses, a /24 is the right size for a single floor or small campus segment. If you need to carve it into smaller pieces, read the /27 example next.

Worked Example: /27

Scenario: Your /24 office network (192.168.10.0/24) needs to be split into eight equal segments, each serving a different department.

8 segments requires 3 additional bits (2^3 = 8). New prefix: /24 + 3 = /27.

StepCalculationResult
Host bits32 - 275
Total addresses2^532
Usable hosts32 - 230
Block size-32 (subnets start every 32 addresses)

The subnet mask is 255.255.255.224. The eight /27 subnets of 192.168.10.0/24 are:

SubnetNetworkFirst UsableLast UsableBroadcast
1192.168.10.0/27192.168.10.1192.168.10.30192.168.10.31
2192.168.10.32/27192.168.10.33192.168.10.62192.168.10.63
3192.168.10.64/27192.168.10.65192.168.10.94192.168.10.95
4192.168.10.96/27192.168.10.97192.168.10.126192.168.10.127
5192.168.10.128/27192.168.10.129192.168.10.158192.168.10.159
6192.168.10.160/27192.168.10.161192.168.10.190192.168.10.191
7192.168.10.192/27192.168.10.193192.168.10.222192.168.10.223
8192.168.10.224/27192.168.10.225192.168.10.254192.168.10.255

Notice that the block size (32) tells you where each subnet starts: 0, 32, 64, 96, and so on. Paste any of these into Subnet Calculator to verify the full detail.

Worked Example: /30

Scenario: You need a subnet for the router-to-router link between two sites. You only need two IP addresses.

StepCalculationResult
Host bits32 - 302
Total addresses2^24
Usable hosts4 - 22
Network address-10.0.0.0
First usableRouter A10.0.0.1
Last usableRouter B10.0.0.2
Broadcast-10.0.0.3

The subnet mask is 255.255.255.252. A /30 is the traditional choice for point-to-point links. If you are tightly conservation-minded, RFC 3021 defines /31 subnets (mask 255.255.255.254) where both addresses are usable host addresses with no network or broadcast, saving two IP addresses per link. Most modern router operating systems support /31; most consumer devices and older Windows stacks do not.

Complete CIDR Reference Table

CIDRSubnet MaskTotal AddressesUsable HostsTypical Use
/32255.255.255.25511Single host route
/31255.255.255.25422Point-to-point (RFC 3021)
/30255.255.255.25242Point-to-point (traditional)
/29255.255.255.24886Small office segment
/28255.255.255.2401614Small department
/27255.255.255.2243230Medium department
/26255.255.255.1926462Large department
/25255.255.255.128128126Half a /24
/24255.255.255.0256254Standard LAN
/23255.255.254.0512510Two /24s combined
/22255.255.252.01,0241,022Four /24s combined
/21255.255.248.02,0482,046Small campus
/20255.255.240.04,0964,094Medium campus
/16255.255.0.065,53665,534Large organization
/8255.0.0.016,777,21616,777,214Massive network

"Usable hosts" is total addresses minus 2, except /31 (special RFC 3021 point-to-point case) and /32 (single host route where the address itself is the host).

Variable-Length Subnet Masking (VLSM)

Fixed-size subnetting wastes addresses when departments vary in size. VLSM lets you use different prefix lengths within the same address block.

My rule: always allocate the largest subnet first. Starting from the biggest requirement means you never run into an alignment problem where a large block can't fit into what is left.

Example: You have 10.0.0.0/24 and need subnets for:

  • Department A: 100 hosts
  • Department B: 50 hosts
  • Department C: 25 hosts
  • Server room: 10 hosts
  • Two WAN links: 2 hosts each

Solution (largest first):

DepartmentHosts NeededSubnet ChosenUsableAssigned Network
Dept A100/25 (128 addr)12610.0.0.0/25
Dept B50/26 (64 addr)6210.0.0.128/26
Dept C25/27 (32 addr)3010.0.0.192/27
Servers10/28 (16 addr)1410.0.0.224/28
WAN link 12/30 (4 addr)210.0.0.240/30
WAN link 22/30 (4 addr)210.0.0.244/30

Total used: 128 + 64 + 32 + 16 + 4 + 4 = 248 addresses out of 256. Six addresses remain unallocated (10.0.0.248-10.0.0.253 plus the block boundaries). That is far better than assigning a separate /24 to each department.

Private Address Ranges (RFC 1918)

Three IPv4 ranges are reserved for private networks by RFC 1918. These addresses are not routed on the public internet and can be used freely within any organization:

RangeCIDRTotal AddressesTypical Use
10.0.0.0 - 10.255.255.25510.0.0.0/816,777,216Large enterprises
172.16.0.0 - 172.31.255.255172.16.0.0/121,048,576Medium organizations
192.168.0.0 - 192.168.255.255192.168.0.0/1665,536Home and small office

Your home router almost certainly assigns addresses from 192.168.0.0/24 or 192.168.1.0/24. That is why your laptop shows something like 192.168.1.45 but a tool like My IP shows a completely different public address. The router performs Network Address Translation (NAT) to bridge the two. For a deeper look at how private and public addresses interact, see Public vs. Private IP Addresses.

IPv6 Subnetting

IPv6 subnetting follows the same prefix-length logic, but scale is not a concern. The conventions for allocation are:

  • ISPs typically assign a /48 to each organization (65,536 individual /64 subnets)
  • Residential customers often receive a /56 (256 /64 subnets)
  • Each /64 is the standard size for a single LAN segment and is required for Stateless Address Autoconfiguration (SLAAC) to function per RFC 4291

With 2^64 host addresses per /64 subnet, address conservation through VLSM is not needed at the LAN level. You can explore IPv6 addresses further with IPv6 Tools.

Key Takeaways

  • The usable host count for any subnet is 2^(32 - prefix) - 2
  • The four-step workflow (count host bits, total addresses, subtract 2, identify range) works for any CIDR prefix
  • /24 gives 254 hosts; /27 gives 30 hosts with a block size of 32; /30 gives 2 hosts for point-to-point links
  • VLSM lets you mix prefix lengths; always allocate the largest requirement first
  • Private ranges (RFC 1918) are 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
  • Use Subnet Calculator for instant results on any block

FAQ

What is the difference between a subnet mask and a CIDR prefix length?

They carry the same information in different formats. A subnet mask is written in dotted-decimal notation, such as 255.255.255.0. The CIDR prefix length, such as /24, is simply the count of the consecutive 1-bits in that mask. Both describe exactly where the network portion ends and the host portion begins in an IP address. Most tools today accept either format.

How many usable hosts does a /27 subnet have?

A /27 has 5 host bits, giving 2^5 = 32 total addresses. Subtract 2 (network address and broadcast address) to get 30 usable host addresses. The subnet mask is 255.255.255.224, and subnets align on boundaries of 32: the first /27 ends at .31, the second starts at .32, and so on.

Why does a /30 subnet only give 2 usable hosts if it has 4 addresses?

The four addresses in a /30 are: the network address (all host bits zero), two usable host addresses, and the broadcast address (all host bits one). The network and broadcast addresses cannot be assigned to devices, leaving exactly 2. The /30 with mask 255.255.255.252 is the traditional choice for a point-to-point router link. RFC 3021 defines /31 as a modern alternative that eliminates the network and broadcast overhead, giving 2 usable addresses from only 2 total, though support varies by operating system and device.

Can I use 192.168.x.x addresses on the internet?

No. The 192.168.0.0/16 range is reserved by RFC 1918 for private use only. Internet routers discard packets sourced from or destined to RFC 1918 addresses, so they never reach the public internet. Your router uses NAT to translate your private 192.168.x.x address to the one public IP address your ISP assigned to you. See Public vs. Private IP Addresses for a full breakdown of how NAT works.

Sources

W

WhatIsMyLocation Team

Our team of network engineers and web developers builds and maintains 25+ free networking and location tools used by thousands of users every month. Every article is reviewed for technical accuracy using real-world testing with our own tools.

Related Articles

Try Our Location Tools

Find your IP address, GPS coordinates, and more with our free tools.