Calculators.Life Calculator
Engineering

IPv4 Subnet Calculator

Input Parameters

Scenarios
Enter a valid IPv4 address (e.g. 192.168.1.1)
Select network prefix or subnet mask

Computed Results

Network Address
152.59.164.8
Broadcast Address152.59.164.11
Subnet Mask255.255.255.252
Wildcard Mask0.0.0.3
Usable Host Range152.59.164.9 - 152.59.164.10
Total Addresses4
Usable Hosts2
IP Class & ScopeClass B (Public)
CIDR Notation152.59.164.8/30

The IPv4 subnet calculator determines network boundaries, broadcast addresses, and usable host ranges based on a given IP address and CIDR prefix. It helps network administrators quickly identify subnet masks, wildcard masks, and total available IP addresses for routing configuration and network planning.

How IPv4 Subnetting Works

Subnetting divides a larger network into smaller, more efficient sub-networks. An IPv4 address consists of 32 bits, divided into four 8-bit octets. The subnet mask (or CIDR prefix) determines how many of those 32 bits represent the network portion, leaving the remaining bits for individual hosts.

To calculate the total number of IP addresses in a subnet, use the following formula based on the CIDR prefix:

Total Addresses = 2(32 − CIDR)

In a standard subnet, the first address is reserved for the network identifier, and the last address is reserved for the broadcast address. Therefore, the formula for usable hosts is:

Usable Hosts = 2(32 − CIDR) − 2

Note: Exceptions apply for /31 subnets (used for point-to-point links, yielding 2 usable hosts) and /32 subnets (used for single host loopbacks, yielding 1 usable host).

Subnet Calculation Examples

Understanding how different CIDR prefixes affect network size is essential for proper IP allocation. Here are three distinct scenarios based on standard networking practices.

Standard Class C Private Network

A common configuration for home and small business networks uses a /24 prefix.

Point-to-Point Link Edge Case

Modern router connections often use a /31 prefix to conserve IP addresses on point-to-point links, eliminating the standard network and broadcast address reservations.

Single Host Loopback Address

A /32 prefix isolates a single specific IP address, commonly used for loopback interfaces or specific firewall rules.

Practical Use Cases

Calculating subnet boundaries is a fundamental task in network engineering. Administrators use these calculations to segment large networks into smaller broadcast domains, which improves network performance and security. By determining the exact usable host range, engineers can assign static IP addresses to servers and configure DHCP pools for client devices without causing IP conflicts.

Additionally, knowing the exact network address and wildcard mask is required when configuring routing protocols (like OSPF or EIGRP) and writing Access Control Lists (ACLs) for firewalls. The calculator instantly provides the wildcard mask by inverting the bits of the subnet mask, streamlining router configuration.

Frequently Asked Questions

What is the difference between a subnet mask and a wildcard mask?

A subnet mask identifies the network and host portions of an IP address, using binary 1s for the network and 0s for the hosts. A wildcard mask is the exact inverse, using binary 0s to match the network and 1s to ignore the host bits. Wildcard masks are primarily used in routing protocols and firewall access control lists.

Why does a /31 subnet have 2 usable hosts instead of 0?

Under standard subnetting rules, subtracting 2 from the total addresses of a /31 subnet would leave 0 usable hosts. However, RFC 3021 established /31 subnets specifically for point-to-point links between routers. In this configuration, the network and broadcast addresses are not reserved, allowing both IP addresses to be assigned to the two connected router interfaces.

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing) notation is a compact way to represent an IP address and its associated routing prefix. It appends a forward slash and a number to the IP address (e.g., 192.168.1.0/24). The number indicates exactly how many bits of the address are used for the network prefix.

Author portrait
About the Author
Arnab Biswas

Calculator developer and SEO strategist who builds practical online calculators and tests calculation logic, input handling, and expected results using real-world scenarios.