Subnet Calculator

Calculate IPv4 subnet details from any IP address and CIDR prefix or subnet mask. Get network address, broadcast, host range, wildcard mask, and binary notation instantly.

🌐 IPv4 Subnet Calculator
Results

Enter an IP address and subnet mask or CIDR prefix to calculate.

Subnet Calculator: IPv4 CIDR and Subnet Mask Tool

This subnet calculator takes any IPv4 address and a CIDR prefix length or subnet mask and instantly returns the complete network details: network address, broadcast address, first and last usable host, wildcard mask, total addresses, usable host count, IP class, address type (private, public, loopback), and the binary representation of both the IP and the mask. It supports prefix lengths from /0 to /32 and accepts subnet masks in dotted-decimal notation such as 255.255.255.0.

Network Address = IP AND Subnet Mask
Broadcast = Network OR Wildcard Mask
Wildcard Mask = NOT Subnet Mask
Total Addresses = 2^(32 - prefix)
Usable Hosts = Total - 2 (or 2 for /31, 1 for /32)

Example: 192.168.1.100/24
Mask: 255.255.255.0 (11111111.11111111.11111111.00000000)
Network: 192.168.1.0 Broadcast: 192.168.1.255
Usable: 192.168.1.1 to 192.168.1.254 (254 hosts)

CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) replaced the old class-based system in 1993. A CIDR prefix such as /24 means the first 24 bits of the 32-bit IPv4 address identify the network. The remaining 8 bits are for hosts, providing 256 addresses (2 to the power of 8). Larger prefix numbers mean smaller subnets: /30 gives 4 addresses, while /16 gives 65,536. The prefix can range from /0 (the entire internet) to /32 (a single host route).

Private vs Public Addresses

RFC 1918 reserves three address ranges for private use: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These addresses are not routable on the public internet and are used in home networks, data centers, and cloud virtual networks. Network Address Translation (NAT) allows devices with private IPs to communicate with the public internet through a router. Loopback addresses (127.0.0.0/8) are used for localhost testing. Link-local addresses (169.254.0.0/16) are assigned automatically when DHCP fails.

Common Subnet Sizes

The most common subnets in enterprise and home networks are /24 (254 usable hosts, one Class C network), /16 (65,534 hosts), and /8 (16.7 million hosts). Smaller subnets are used for point-to-point links: /30 provides exactly 2 usable host addresses ideal for router interfaces. /31 subnets (RFC 3021) are used for point-to-point links without a dedicated broadcast address, providing 2 usable addresses. /32 routes point to a single host and are used in firewall rules and BGP advertisements.

Wildcard Masks and ACLs

Wildcard masks are the bitwise complement of subnet masks and are used in Cisco IOS access control lists and OSPF configuration. A 0 bit means that bit must match; a 1 bit means it can be anything. For a /24 network the wildcard is 0.0.0.255, meaning the first three octets must match exactly while the last octet can be any value. Understanding wildcard masks is essential for writing precise firewall rules and routing policies.

Tips & Recommendations

CIDR or Mask Both Work

Enter just a number like 24 for the CIDR prefix, or the full subnet mask like 255.255.255.0. The calculator accepts both formats and converts between them automatically.

Use the Preset Dropdown

Select from common prefixes /8 through /32 to auto-fill the prefix field. This is useful when you know the network size you need but want to confirm the host count.

Binary View for Learning

The binary representation shows exactly which bits are the network portion (1s in the mask) and which are the host portion (0s). This is the clearest way to understand how subnetting works.

Wildcard for Firewall Rules

Copy the wildcard mask directly into Cisco ACL or OSPF commands. For 192.168.1.0/24 the wildcard 0.0.0.255 matches all hosts in that subnet.

Frequently Asked Questions

What is a subnet?

A subnet (subnetwork) is a logically partitioned segment of a larger IP network. Subnetting divides a network into smaller, manageable blocks, each with its own address range. This reduces broadcast traffic, improves security, and makes IP address management more efficient.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation expresses an IP address and its network prefix together, such as 192.168.1.0/24. The number after the slash indicates how many bits are used for the network portion. A /24 means 24 bits for the network and 8 bits for hosts, giving 256 total addresses and 254 usable hosts.

What is the difference between network address and broadcast address?

The network address is the first address in a subnet block and identifies the network itself: it cannot be assigned to a host. The broadcast address is the last address in the block and is used to send data to all hosts on the subnet simultaneously: it also cannot be assigned to a host. All addresses between them are usable host addresses.

What is a wildcard mask?

A wildcard mask is the bitwise inverse of a subnet mask. It is used in access control lists (ACLs) on routers and firewalls to specify which bits of an IP address must match exactly and which are allowed to vary. For a /24 network (mask 255.255.255.0), the wildcard mask is 0.0.0.255.

What are private IP address ranges?

RFC 1918 defines three private IP ranges not routable on the public internet: 10.0.0.0/8 (Class A, ~16.7 million addresses), 172.16.0.0/12 (Class B, ~1 million addresses), and 192.168.0.0/16 (Class C, 65,536 addresses). These are used in home networks, corporate intranets, and cloud virtual networks.

How many hosts fit in a /24, /16, and /8 subnet?

A /24 subnet has 256 total addresses and 254 usable hosts. A /16 has 65,536 total and 65,534 usable hosts. A /8 has 16,777,216 total and 16,777,214 usable hosts. In each case, 2 addresses are reserved for the network address and broadcast address.

Recent Calculations

No calculations yet

Last updated: May 21, 2026