Home / 🃏 Internet/ IP Subnet Calculator


IP Subnet Calculator

Print
Compute IPv4 subnets, netmasks, broadcast addresses, wildcard masks, host ranges, and calculate subnetting configurations for IPv6 networks.
IPv4 Subnet Calculator
IPv4 Subnet Results
CIDR Notation -
Subnet Mask -
Wildcard Mask -
Network Address -
Usable Host Range -
Broadcast Address -
Total Usable Hosts -
IPv6 Subnet Calculator
IPv6 Subnet Results
Full IPv6 Address -
Compressed Address -
Network Prefix -
Prefix Range -
Total Addresses -

Designing efficient network topologies, allocating IP addresses, and securing corporate intranets requires partition management. Dividing a single physical network into smaller, logical subnetworks (subnets) prevents broadcast congestion, optimizes traffic flow, and establishes administrative boundaries.

Our free online IP Subnet Calculator computes essential networking metrics for both legacy IPv4 and modern IPv6 architectures:

  • IPv4 Subnet Calculator: Input a starting IP address (e.g., 152.58.62.162), choose a subnet class or custom subnet mask (e.g., 255.255.255.252 /30), and view the network address, usable host range, broadcast address, and network class.
  • IPv6 Subnet Calculator: Input an IPv6 address (e.g., 2001:db8:85a3::8a2e:370:7334) and select a prefix length (e.g., /64) to determine routing prefixes and subnetwork allocations.

Understanding Subnetting: TCP/IP Routing Boundaries

Subnetting is the practice of splitting a single IP network into two or more smaller subnetworks. Routers serve as the physical boundaries between these subnets, managing the flow of data packets based on network rules.

An IP address is split into two primary components:

  • Network Prefix (Routing Prefix): Tells routers which subnetwork a device belongs to. In IPv4, this is defined by a subnet mask (expressed in dot-decimal notation, like 255.255.255.0). In IPv6, it is defined by the prefix length (the number of static routing bits, like /64).
  • Host Identifier (Rest Field): Identifies the specific network interface of the individual device within that subnetwork.

All host devices sharing a subnetwork must have the same network prefix, while their host identifiers must remain unique to prevent IP address conflicts.


Classful Networking vs. Classless Inter-Domain Routing (CIDR)

Historically, IPv4 networks were divided into rigid classes based on the initial bits of the IP address:

  • Class A: Starts with bits 0-127, using a default subnet mask of 255.0.0.0 (a /8 prefix size). Allows for over 16 million hosts per network.
  • Class B: Starts with bits 128-191, using a default subnet mask of 255.255.0.0 (a /16 prefix size). Allows for 65,534 hosts.
  • Class C: Starts with bits 192-223, using a default subnet mask of 255.255.255.0 (a /24 prefix size). Allows for 254 hosts.

This “classful” system was highly inefficient, leading to wasted IP address space. To fix this, the networking industry introduced Classless Inter-Domain Routing (CIDR). CIDR allows variable-length subnet masks (VLSM), meaning prefixes can be customized to any bit length (e.g., /27 or /30) to fit the exact host requirements of a network.


IPv4 Subnet Prefix Reference Table

The table below provides a comprehensive breakdown of standard IPv4 prefixes, showing their dot-decimal subnet masks and the maximum number of usable host devices per subnet.

*Note: For prefixes /30 and shorter, the number of usable hosts is calculated as 2^(32 - Prefix Size) - 2. We subtract 2 addresses because the first address represents the Network Address, and the last address represents the Broadcast Address, both of which cannot be assigned to individual hosts.

Prefix Size Subnet Network Mask Usable Hosts per Subnet Historical Class Association
/1 128.0.0.0 2,147,483,646 Class A Subdivisions
/2 192.0.0.0 1,073,741,822 Class A Subdivisions
/3 224.0.0.0 536,870,910 Class A Subdivisions
/4 240.0.0.0 268,435,454 Class A Subdivisions
/5 248.0.0.0 134,217,726 Class A Subdivisions
/6 252.0.0.0 67,108,862 Class A Subdivisions
/7 254.0.0.0 33,554,430 Class A Subdivisions
/8 255.0.0.0 16,777,214 Class A Base Mask
/9 255.128.0.0 8,388,606 Class B Subdivisions
/10 255.192.0.0 4,194,302 Class B Subdivisions
/11 255.224.0.0 2,097,150 Class B Subdivisions
/12 255.240.0.0 1,048,574 Class B Subdivisions
/13 255.248.0.0 524,286 Class B Subdivisions
/14 255.252.0.0 262,142 Class B Subdivisions
/15 255.254.0.0 131,070 Class B Subdivisions
/16 255.255.0.0 65,534 Class B Base Mask
/17 255.255.128.0 32,766 Class C Subdivisions
/18 255.255.192.0 16,382 Class C Subdivisions
/19 255.255.224.0 8,190 Class C Subdivisions
/20 255.255.240.0 4,094 Class C Subdivisions
/21 255.255.248.0 2,046 Class C Subdivisions
/22 255.255.252.0 1,022 Class C Subdivisions
/23 255.255.254.0 510 Class C Subdivisions
/24 255.255.255.0 254 Class C Base Mask
/25 255.255.255.128 126 Sub-Class C Subnet
/26 255.255.255.192 62 Sub-Class C Subnet
/27 255.255.255.224 30 Sub-Class C Subnet
/28 255.255.255.240 14 Sub-Class C Subnet
/29 255.255.255.248 6 Sub-Class C Subnet
/30 255.255.255.252 2 Sub-Class C Subnet
/31 255.255.255.254 0 Point-to-Point Link
/32 255.255.255.255 0 Loopback / Single Host

To perform calculations in binary representation, use our Binary Calculator. To convert hexadecimal codes to binary or decimal numbers, visit our Hex Calculator.


Frequently Asked Questions (FAQ)

What is a subnet mask?

A subnet mask is a 32-bit number used in IPv4 networking to distinguish between the network prefix portion and the host identifier portion of an IP address. It is written in dot-decimal format (such as 255.255.255.0).

Why are 2 host addresses subtracted from each subnet?

In standard IPv4 subnets, two addresses are reserved for network administrative roles and cannot be assigned to hosts:

  • The Network Address: The first address in the subnet range, where all host bits are set to 0. Used to identify the subnet itself.
  • The Broadcast Address: The last address in the subnet range, where all host bits are set to 1. Used to send data packets to all hosts on the subnet simultaneously.

What is the difference between IPv4 and IPv6 subnetting?

IPv4 uses 32-bit addresses, requiring subnet masks or CIDR prefix lengths to allocate space, with addresses rapidly exhausting. IPv6 uses 128-bit addresses (written in hexadecimal), offering a virtually infinite address pool. In IPv6, subnet masks are replaced entirely by CIDR prefix lengths (typically using a default prefix of /64 for individual local subnets).

What is CIDR notation?

Classless Inter-Domain Routing (CIDR) notation is a simplified way to represent an IP address and its associated routing prefix. It appends a slash followed by the number of network bits to the address (for example, 192.168.1.0/24), replacing long dot-decimal subnet masks.