Skip to main content
AllDevToolsHub
🌐

IPv4 Subnet Calculator

100% Local

Calculate network, broadcast, host range, and CIDR details.

IPv4 Subnet Calculator
Network Address192.168.1.0
Broadcast Address192.168.1.255
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Total Hosts256
Usable Hosts254
CIDR Notation192.168.1.0/24
IP ClassC
Type:Private (RFC 1918)
Binary Representations
IP:11000000.10101000.00000001.01100100
Mask:11111111.11111111.11111111.00000000
Try:
This tool runs entirely in your browser. Your input is never uploaded, logged, or sent to AllDevToolsHub or anyone else, and it keeps working offline once the page has loaded.

Enter an IP with CIDR notation (e.g., 10.0.5.42/22) to see subnet details.

Overview

What is IPv4 Subnet Calculator?

Enter any IPv4 address with a CIDR prefix to get full subnet details: network, broadcast, subnet mask, wildcard, usable hosts, binary, class, and RFC 1918.
FAQ

Frequently Asked Questions

Reference

Technical Deep Dive

DEVELOPMENT TOOLS

IPv4 Subnet Calculator

Enter any IPv4 address with a CIDR prefix to get full subnet details including network address, broadcast address, subnet mask, wildcard mask, usable host range, binary representations, IP class, and RFC 1918 private detection.

🧮

Full CIDR breakdown

Enter an address and prefix and get network, broadcast, first/last host, usable count, wildcard mask, and the /24-style range.

✂️

Subnetting help

Split a block into equal subnets or fit a host count, with the resulting prefix and ranges listed.

🔒

Pure math, local

No lookups — every value is calculated from the address and mask in your browser.

IPv4 Subnetting: A Practical Reference

Subnetting is one of those topics that seems hard until it clicks, then turns out to be just bit manipulation. CIDR (Classless Inter-Domain Routing) replaced the old class-based system in 1993 and gave us a clean rule: a network is defined by an address and a prefix length, where the prefix tells you how many leading bits are the network portion. Everything else, netmask, broadcast, host count, derives mechanically from those two numbers. This calculator does the derivation; this reference covers when each output matters.

The Basics

An IPv4 address is 32 bits, conventionally written as four 8-bit octets in decimal: 192.168.1.42. The CIDR prefix says how many of those bits are network vs host:

Within a /24:

  • Network address: 192.168.1.0, first address; identifies the subnet.
  • Broadcast address: 192.168.1.255, last address; sends to every host.
  • Usable hosts: 192.168.1.1 through 192.168.1.254 (254 addresses).
  • Subnet mask: 255.255.255.0, 24 leading 1s in binary.
  • Wildcard mask: 0.0.0.255, inverse of subnet mask.

Total addresses in a subnet: 2^(32-prefix). Usable hosts: 2^(32-prefix) - 2 (subtract network + broadcast).

Common Subnet Sizes

CIDR Mask Total Usable Common Use
/32 255.255.255.255 1 1 (host route) Loopback, ACL match, IPv4 BGP /32
/31 255.255.255.254 2 2 (RFC 3021) Point-to-point links
/30 255.255.255.252 4 2 Point-to-point with network+broadcast
/29 255.255.255.248 8 6 Small router segment
/28 255.255.255.240 16 14 Small office, AWS subnet minimum
/27 255.255.255.224 32 30 Departmental VLAN
/26 255.255.255.192 64 62 Mid-size LAN
/25 255.255.255.128 128 126 Half /24
/24 255.255.255.0 256 254 Office LAN, typical VLAN, AWS subnet
/23 255.255.254.0 512 510 Larger LAN
/22 255.255.252.0 1024 1022 Floor / building
/21 255.255.248.0 2048 2046 Campus zone
/20 255.255.240.0 4096 4094 Small cloud VPC
/16 255.255.0.0 65536 65534 Cloud VPC, large campus
/12 255.240.0.0 1M ~1M RFC 1918 (172.16/12)
/8 255.0.0.0 16.7M ~16.7M RFC 1918 (10/8)

Cloud convention (AWS, GCP, Azure):

  • VPC = /16 (e.g., 10.0.0.0/16).
  • Subnet per AZ = /24 (e.g., 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24).
  • AWS reserves the first 4 + last 1 IP in each subnet (so a /28 has 11 usable, not 14).

The Math (Bit-Level View)

For 192.168.5.42/22:

A common mistake: assuming the IP you gave is the network address. It isn't necessarily. 192.168.5.42/22 is inside the network 192.168.4.0/22, the IP "belongs to" that network. The calculator shows what network contains your IP.

CIDR Aggregation

CIDR enables route aggregation: multiple contiguous subnets advertised as one larger block.

These four /24 blocks aggregate to 192.168.0.0/22 (covers all four). Routers advertise one route instead of four, smaller routing tables, faster lookups.

For aggregation to work: the smaller blocks must be contiguous and aligned on the larger boundary. 192.168.0.0/24 + 192.168.2.0/24 doesn't aggregate (gap at 192.168.1.x).

Subnetting Strategy

Step 1: How many subnets do you need?

A site might need:

  • 3 dev environments (dev, staging, prod) × 3 AZs = 9 subnets.
  • Public + private + database tiers = 3 per environment.
  • Maybe 18+ subnets total.
Step 2: How many hosts per subnet?

Estimate per tier:

  • Database subnets: small (~5 instances) → /28 (14 usable) is plenty.
  • Application subnets: medium-large (~100-200 instances + room for scale) → /24 (254 usable).
  • Public subnets: small (just load balancers) → /27.
Step 3: Carve out a parent CIDR

Pick an RFC 1918 range with room for everything: 10.50.0.0/16 gives 65,534 addresses.

Step 4: Subdivide

Leave room for growth: don't allocate every /24 immediately. If your VPC is /16 and you only have 3 AZs, you have ~16 unused /20 blocks for future expansion.

Private Address Ranges (RFC 1918)

Plus:

  • 127.0.0.0/8, loopback (127.0.0.1 is the most famous).
  • 169.254.0.0/16, link-local (DHCP failed; cloud metadata service at 169.254.169.254).
  • 100.64.0.0/10, Carrier-grade NAT (RFC 6598).
  • 224.0.0.0/4, Multicast.
  • 240.0.0.0/4, Reserved (former "Class E").

Picking private ranges to minimize collision:

  • Avoid 10.0.0.0/24 (used by Cisco default configs).
  • Avoid 192.168.1.0/24 and 192.168.0.0/24 (consumer router defaults).
  • Pick a less-common slice: 10.123.45.0/24 for a small office; 10.0.0.0/8 allocated by RFC means anyone on it can clash with you, but 10.123.0.0/16 is statistically much less common.

Classes (Historical)

Pre-CIDR, addresses were divided by leading bits:

Class Leading bits First octet range Default mask
A 0 0-127 /8
B 10 128-191 /16
C 110 192-223 /24
D 1110 224-239 multicast
E 1111 240-255 reserved

Modern routers don't care; mask comes from CIDR. The "class" label is mostly historical, but some legacy tools still show it.

Useful Quick Reference

Powers of 2

For a quick "how many addresses?": subtract prefix from 32, raise 2 to that power.

Mask values

Memorize 128 / 192 / 224 / 240 / 248 / 252 / 254 / 255, the values that appear in masks.

Common Use Cases

Firewall rules

Calculator confirms ranges; firewall syntax converts CIDR to wildcard or netmask if needed.

VPN tunnels

Both ends must not have overlapping CIDR for traffic to route. Calculator confirms ranges.

AWS Security Groups

Source/destination as CIDR. 10.0.0.0/16 allows the whole VPC; 10.0.1.0/24 allows one subnet; 0.0.0.0/0 allows the world.

Routing tables

Longest-prefix match: 10.0.5.42 matches the /16 entry; 8.8.8.8 matches the default.

IP allocation planning

Calculate how many /24 subnets fit in a /16 (256), how many /28s fit in a /24 (16).

IPv6 Note

This calculator is IPv4-specific. IPv6 uses much larger addresses (128-bit) and a similar CIDR concept (/64 is the standard subnet size; /48 is typical site allocation). IPv6 has no broadcast (no usable-1) and reserves fewer addresses per subnet, a /64 has 2^64 usable hosts in theory (in practice, only some addresses are used).

Privacy

All subnet math is bitwise arithmetic in JavaScript, parse, AND with mask, OR with wildcard, format output. Open DevTools Network during use: zero outbound requests. Subnet plans implicitly document network architecture (VPC layout, on-prem allocations, VPN configurations) which is itself sensitive infrastructure information; sending it to an online calculator would leak that context. Keep it local.

You Might Also Need