Free IP Subnet Calculator โ€” IPv4 Network Calculator

Instantly calculate network address, broadcast address, subnet mask, wildcard mask, host range and usable hosts for any IPv4 subnet. Enter an IP address and CIDR prefix to get full subnet details in real time.

Advertisement ยท 728ร—90
Enter a valid IPv4 address (e.g. 192.168.1.0).
/
Enter a valid subnet mask (e.g. 255.255.255.0).

Enter an IPv4 address and CIDR prefix (or subnet mask) to calculate subnet details.

Advertisement ยท 300ร—250

What Is Subnetting and Why Does It Matter?

Subnetting is the practice of dividing a single IP network into smaller, more manageable sub-networks called subnets. Originally, the IPv4 address space was divided into fixed classes (A, B, C), but this proved wasteful โ€” a company needing 300 hosts would need a full Class B block of 65,534 addresses, wasting over 65,000 addresses. Subnetting, formalized through Classless Inter-Domain Routing (CIDR) in the early 1990s, solved this by allowing networks to be subdivided at arbitrary bit boundaries.

In practice, subnetting matters for several reasons. Security: Separate subnets can be isolated with firewalls and access-control lists, so a compromised device in one subnet cannot easily reach devices in another. Performance: Broadcast traffic is contained within a subnet; smaller subnets mean smaller broadcast domains and less congestion. Organization: Departments, floors, services, or environments (production, staging, development) can each have their own subnet, simplifying network management and troubleshooting. IP address conservation: Properly sized subnets avoid allocating hundreds of unused addresses to small teams or point-to-point links.

Every network engineer, system administrator, cloud architect, and DevOps practitioner encounters subnetting regularly. Cloud providers like AWS, Azure, and GCP require you to define VPC subnets before provisioning resources. Docker and Kubernetes use internal subnets for container networking. Home routers create a subnet (usually 192.168.1.0/24) for your local devices. Understanding subnetting is a foundational skill that underpins all of modern networking.

CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) notation represents an IP address and its associated network prefix length in a compact form: IP address / prefix length. For example, 192.168.1.0/24 means the first 24 bits of the address identify the network, and the remaining 8 bits identify hosts within that network.

The prefix length (also called the subnet mask length or CIDR block) ranges from /0 (the entire internet, 4,294,967,296 addresses) to /32 (a single host address). Common values you will encounter:

  • /8 โ€” 16,777,216 addresses. Used for large ISPs, historical Class A allocations.
  • /16 โ€” 65,536 addresses. Common for large enterprise networks, AWS VPCs.
  • /24 โ€” 256 addresses (254 usable). The most common subnet size for office networks and home LANs.
  • /25 โ€” 128 addresses (126 usable). Splits a /24 in half.
  • /28 โ€” 16 addresses (14 usable). Small office segments, cloud subnets.
  • /30 โ€” 4 addresses (2 usable). Point-to-point links between routers.
  • /32 โ€” 1 address. Used for host routes, loopback addresses, firewall rules targeting a single IP.

To convert between CIDR and dotted-decimal subnet mask, recall that a /24 mask has 24 consecutive 1-bits: 11111111.11111111.11111111.00000000 = 255.255.255.0. A /20 mask = 11111111.11111111.11110000.00000000 = 255.255.240.0. The binary representation shown in this calculator makes this relationship explicit.

IPv4 Address Classes (A, B, C)

Before CIDR, the IPv4 address space was divided into fixed classes defined by the first octet of the address. While classful addressing is largely obsolete in modern routing, you will still encounter these class designations in documentation, textbooks, firewall rules, and vendor interfaces.

  • Class A (first octet 1โ€“126): Designed for very large networks. Default mask /8 (255.0.0.0). Examples: 10.0.0.0, 72.0.0.0. The 10.0.0.0/8 private range falls here.
  • Class B (first octet 128โ€“191): Designed for medium-to-large networks. Default mask /16 (255.255.0.0). Examples: 172.16.0.0 (private), 150.0.0.0. The 172.16.0.0โ€“172.31.255.255 private range falls here.
  • Class C (first octet 192โ€“223): Designed for small networks. Default mask /24 (255.255.255.0). Examples: 192.168.1.0 (private). The entire 192.168.0.0/16 private range is here.
  • Class D (first octet 224โ€“239): Reserved for multicast. Not used for unicast host addressing.
  • Class E (first octet 240โ€“255): Reserved for experimental use.
  • Loopback (127.x.x.x): Reserved for the loopback interface. 127.0.0.1 is the canonical localhost address.

The three private IP ranges (RFC 1918) โ€” 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 โ€” are not routable on the public internet and are freely usable within private networks. Most home and office networks use 192.168.x.x addresses.

Common Subnet Masks and Their Uses

Selecting the right subnet size is a balance between having enough IP addresses for current and future hosts while avoiding wasteful over-allocation. Here are the most common subnet sizes and their typical applications:

CIDR Subnet Mask Total IPs Usable Hosts Typical Use
/8255.0.0.016,777,21616,777,214Large ISP, national carrier allocations
/16255.255.0.065,53665,534Enterprise WAN, large AWS VPC
/20255.255.240.04,0964,094Large campus segment, data centre block
/24255.255.255.0256254Office LAN, home network, cloud subnet
/25255.255.255.128128126Half of a /24, medium department
/26255.255.255.1926462Small department, DMZ segment
/27255.255.255.2243230Small team, server cluster
/28255.255.255.2401614Small office, cloud management subnet
/29255.255.255.24886Small group of servers, IoT cluster
/30255.255.255.25242Point-to-point router links
/31255.255.255.25422Point-to-point links (RFC 3021, no network/broadcast)
/32255.255.255.25511Host routes, loopback, firewall rules

When designing a network, a common best practice is to allocate subnets slightly larger than needed โ€” for example, using a /25 (126 hosts) rather than a /26 (62 hosts) for a department that currently has 50 devices โ€” to allow for growth without renumbering. Cloud environments like AWS additionally reserve the first four and last IP in each subnet for infrastructure use, reducing usable hosts further.

Frequently Asked Questions

A /24 subnet (subnet mask 255.255.255.0) contains 256 total IP addresses. The first 24 bits of the address identify the network and the last 8 bits identify individual hosts. For example, 192.168.1.0/24 spans addresses 192.168.1.0 through 192.168.1.255. The network address (192.168.1.0) and broadcast address (192.168.1.255) are reserved, leaving 254 usable host addresses (192.168.1.1 through 192.168.1.254). The /24 is by far the most common subnet size for home networks, small offices, and many cloud VPC subnets.

A /24 subnet has 2^8 = 256 total IP addresses. Of these, 2 are reserved: the network address (first IP) and the broadcast address (last IP). This leaves 254 usable host addresses. In general, for a subnet with prefix length n, the total addresses are 2^(32-n) and the usable host count is 2^(32-n) - 2 for prefixes /1 through /30. For /31 subnets (used on point-to-point links per RFC 3021), both addresses are usable as host addresses. A /32 subnet represents exactly one host.

The network address is the first address in a subnet โ€” it identifies the subnet itself and cannot be assigned to a host. It is calculated by performing a bitwise AND between the IP address and the subnet mask. For 192.168.1.100/24, the network address is 192.168.1.0. The broadcast address is the last address in the subnet. Packets sent to the broadcast address are delivered to every host in the subnet. It is calculated by taking the network address and setting all host bits to 1. For 192.168.1.0/24, the broadcast address is 192.168.1.255. All usable host addresses fall between these two reserved addresses.

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask has 1-bits indicating the network portion, a wildcard mask has 0-bits, and vice versa. For a subnet mask of 255.255.255.0, the wildcard mask is 0.0.0.255. Wildcard masks are used extensively in Cisco IOS access-control lists (ACLs) and OSPF area configurations to specify which bits of an address must match (0-bit = must match) and which can be anything (1-bit = don't care). For example, an ACL entry of permit ip 10.0.0.0 0.255.255.255 permits any address in the 10.0.0.0/8 range.

To split a /24 into smaller subnets, increase the prefix length (borrow bits from the host portion). Each additional bit doubles the number of subnets while halving the host count per subnet. Starting from 192.168.1.0/24: dividing into two /25 subnets gives 192.168.1.0/25 (hosts .1โ€“.126) and 192.168.1.128/25 (hosts .129โ€“.254). Dividing into four /26 subnets gives .0/26, .64/26, .128/26, .192/26 โ€” each with 62 usable hosts. Dividing into eight /27 subnets (30 usable hosts each) or sixteen /28 subnets (14 usable hosts each) follows the same pattern. The network address of each subnet is always a multiple of the block size (2^(32-cidr)).

IPv4 uses 32-bit addresses (giving ~4.3 billion unique addresses) while IPv6 uses 128-bit addresses (giving 3.4 ร— 10^38 addresses โ€” a number so large that every device on earth could have trillions of unique IPs). Both use CIDR prefix notation, but IPv6 subnets are far larger. A typical IPv6 end-site allocation is a /48, containing 2^80 addresses โ€” more than all IPv4 addresses combined, 2^80 times over. The standard IPv6 LAN subnet is a /64, giving 2^64 addresses per segment. IPv6 eliminates the need for NAT (Network Address Translation) entirely, as every device can have a globally unique address. Subnetting concepts (network address, host range, prefix length) are identical in principle but the sheer scale of IPv6 means running out of addresses is no longer a concern.

Related Free Tools

Need a custom tool built for your business?

Get a Free Quote