IP Subnet Calculator - IPv4 & IPv6 CIDR, Subnet Mask, Network Address

IPv4 Subnet Configuration

Select a class for default subnet mask

/

Enter CIDR prefix length (0-32)

Enter IPv4 address (e.g., 192.168.1.1)

Configure your IPv4 subnet and click Calculate to see results

Understanding IP Subnet Calculation and Network Design

IP subnetting is a fundamental networking concept that divides large networks into smaller, more manageable segments. This calculator supports both IPv4 and IPv6, providing complete subnet information including network addresses, broadcast addresses, usable host ranges, and binary representations for detailed network analysis and planning.

What is IP Subnetting?

IP subnetting is the practice of dividing a single network into multiple logical sub-networks (subnets). This division serves several critical purposes:

  • Network Performance: Reduces broadcast traffic by limiting broadcast domains to smaller segments
  • Security: Isolates different network segments, containing security breaches and simplifying access control
  • Efficient IP Allocation: Optimizes IP address usage by matching subnet sizes to actual needs
  • Simplified Management: Makes large networks easier to troubleshoot, monitor, and maintain
  • Geographical Organization: Allows logical grouping of network resources by location or department

CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) notation is the modern standard for specifying IP addresses and their associated network prefixes. It uses the format IP/prefix, where the prefix indicates how many bits represent the network portion.

CIDRSubnet MaskTotal AddressesUsable HostsCommon Use
/8255.0.0.016,777,21616,777,214Large ISP, Class A
/16255.255.0.065,53665,534Large enterprise, Class B
/24255.255.255.0256254Standard subnet, Class C
/25255.255.255.128128126Medium subnet
/26255.255.255.1926462Small office
/30255.255.255.25242Point-to-point links
/32255.255.255.25511Single host route

Calculating Usable Hosts

The formula for calculating the number of usable hosts in an IPv4 subnet is:

Usable Hosts = 2(32 - CIDR) - 2

The "-2" accounts for the network address and broadcast address

Example calculations:

  • /24: 28 - 2 = 256 - 2 = 254 usable hosts
  • /25: 27 - 2 = 128 - 2 = 126 usable hosts
  • /26: 26 - 2 = 64 - 2 = 62 usable hosts
  • /30: 22 - 2 = 4 - 2 = 2 usable hosts (point-to-point links)

Private vs. Public IP Addresses

Understanding the distinction between private and public IP addresses is crucial for network design:

Private IP Ranges (RFC 1918)

  • 10.0.0.0/8
    10.0.0.0 – 10.255.255.255
    16,777,216 addresses
  • 172.16.0.0/12
    172.16.0.0 – 172.31.255.255
    1,048,576 addresses
  • 192.168.0.0/16
    192.168.0.0 – 192.168.255.255
    65,536 addresses

βœ“ Use for internal networks, not routable on Internet

Public IP Addresses

  • β€’ Globally unique and routable on the Internet
  • β€’ Assigned by ISPs or regional registries (ARIN, RIPE, APNIC, LACNIC, AFRINIC)
  • β€’ Required for servers accessible from the Internet
  • β€’ Limited availability (IPv4 address exhaustion)
  • β€’ Organizations typically use NAT to share one public IP among many private IPs

Network Address and Broadcast Address

Every subnet has two special addresses that cannot be assigned to hosts:

  • Network Address: The first address in the subnet, where all host bits are 0. It identifies the network itself and is used in routing tables. Example: For 192.168.1.0/24, the network address is 192.168.1.0.
  • Broadcast Address: The last address in the subnet, where all host bits are 1. Used to send packets to all hosts in the subnet simultaneously. Example: For 192.168.1.0/24, the broadcast address is 192.168.1.255.

IPv6 Subnetting

IPv6 uses 128-bit addresses, providing an astronomical 340 undecillion (3.4 Γ— 1038) addresses. This abundance changes how we approach subnetting:

  • /48 Prefix: Standard allocation for sites (281 trillion subnets available)
  • /64 Prefix: Standard subnet size (18.4 quintillion addresses per subnet)
  • /128 Prefix: Single host address (equivalent to IPv4 /32)
  • No Broadcast: IPv6 uses multicast instead of broadcast addresses
  • No NAT Required: Eliminates the need for address translation
  • Hierarchical Design: Focus on organizational structure rather than address conservation

VLSM (Variable Length Subnet Masking)

VLSM allows you to use different subnet mask lengths within the same network, enabling more efficient IP address allocation:

Example: Subdividing 192.168.1.0/24

  • β€’ Subnet 1: 192.168.1.0/26 (62 hosts) - Main office
  • β€’ Subnet 2: 192.168.1.64/26 (62 hosts) - Sales department
  • β€’ Subnet 3: 192.168.1.128/27 (30 hosts) - Engineering
  • β€’ Subnet 4: 192.168.1.160/27 (30 hosts) - Marketing
  • β€’ Subnet 5: 192.168.1.192/28 (14 hosts) - Server room
  • β€’ Subnet 6: 192.168.1.208/28 (14 hosts) - Guest Wi-Fi
  • β€’ Point-to-point links: Multiple /30 subnets from remaining space

Wildcard Masks

Wildcard masks are the inverse of subnet masks, primarily used in Cisco access control lists (ACLs) and OSPF routing. They indicate which bits to ignore when matching addresses:

  • Calculated as: Wildcard = 255.255.255.255 - Subnet Mask
  • Example: Subnet mask 255.255.255.0 β†’ Wildcard 0.0.0.255
  • "0" in wildcard = must match exactly
  • "255" in wildcard = any value acceptable
  • Used in ACLs: access-list 10 permit 192.168.1.0 0.0.0.255

Subnet Planning Best Practices

Do:

  • βœ“ Plan for growth (allocate 30-50% extra capacity)
  • βœ“ Document your IP allocation scheme
  • βœ“ Use private IPs for internal networks
  • βœ“ Implement hierarchical addressing
  • βœ“ Standardize subnet sizes where possible
  • βœ“ Leave room for future subnets
  • βœ“ Use summarization-friendly allocations

Don't:

  • βœ— Over-allocate address space unnecessarily
  • βœ— Use random, non-contiguous subnets
  • βœ— Forget to account for network and broadcast addresses
  • βœ— Ignore future expansion needs
  • βœ— Use overlapping subnets
  • βœ— Mix public and private IPs carelessly
  • βœ— Forget to update documentation

Common Subnetting Scenarios

Scenario 1: Small Office Network

Requirement: 50 employees, each with a computer and phone

Solution: 192.168.1.0/25 (126 usable hosts)

Provides room for 100 devices plus growth. Subnet mask: 255.255.255.128

Scenario 2: Point-to-Point Router Link

Requirement: Connect two routers

Solution: 10.0.0.0/30 (2 usable hosts)

Minimal waste, standard for WAN links. Subnet mask: 255.255.255.252

Scenario 3: Multi-Floor Office Building

Requirement: 5 floors, 100 devices per floor

Solution: Use /25 subnets from a /21 allocation

  • β€’ Floor 1: 10.0.0.0/25 (126 hosts)
  • β€’ Floor 2: 10.0.0.128/25 (126 hosts)
  • β€’ Floor 3: 10.0.1.0/25 (126 hosts)
  • β€’ Floor 4: 10.0.1.128/25 (126 hosts)
  • β€’ Floor 5: 10.0.2.0/25 (126 hosts)
  • β€’ Remaining space for servers, Wi-Fi, guests

Binary Subnet Calculation

Understanding binary is essential for truly mastering subnetting. Here's how to perform a subnet calculation at the bit level:

Example: Find the network address of 192.168.45.78/26

IP Address: 11000000.10101000.00101101.01001110
Subnet Mask: 11111111.11111111.11111111.11000000
Network (AND): 11000000.10101000.00101101.01000000
Result: 192.168.45.64

The AND operation keeps network bits, zeros out host bits

Troubleshooting Subnet Issues

Common problems and their solutions:

Problem: Devices can't communicate across subnets

Solution: Check default gateway configuration and routing tables. Ensure inter-VLAN routing is properly configured.

Problem: Running out of IP addresses in a subnet

Solution: Redesign with a larger subnet prefix (smaller CIDR number) or implement VLSM. Consider IPv6 migration.

Problem: Overlapping subnets

Solution: Audit IP allocation, use IP Address Management (IPAM) tools, maintain accurate documentation.

Further Resources

For additional information and standards:

Related Calculators