Skip to content
CalculatorPro — Free Online Calculators

IP Subnet Calculator — Free CIDR Network Address Tool

Calculate network address, broadcast, host range, and subnet mask from any IP and CIDR prefix, helping network engineers plan and divide IP space fast.

ByEditorial Team, Computer Science Updated Jun 7, 20262026 verified Methodology

About this calculator

IP Subnet Calculator

Comprehensive Guide to IP Subnetting

In computer networking, a single large IP network is rarely efficient. Broadcasting traffic across thousands of devices causes massive network congestion and security vulnerabilities. To solve this, network engineers use Subnetting—the process of logically dividing a single large network into multiple smaller, isolated networks.

The math behind subnetting involves complex binary conversions. The IP Subnet Calculator instantly performs this bitwise arithmetic, providing you with the exact network boundaries, usable IP ranges, and broadcast addresses for any given IP and CIDR mask.

How to Use the IP Subnet Calculator

To design or troubleshoot a network, you need two pieces of information:

  1. Enter the IP Address: Input any IPv4 address within the network (e.g., 192.168.1.50).
  2. Enter the CIDR / Subnet Mask: Input the Classless Inter-Domain Routing (CIDR) notation (e.g., /24) or the decimal subnet mask (e.g., 255.255.255.0).
  3. Calculate: The tool will define the exact logical boundaries of that specific subnet.

The Calculator Formulas

The core of subnetting involves converting the IP address and the Subnet Mask into 32-bit binary numbers, and then performing logical AND, OR, and NOT operations.

Finding the Network Address

The Network Address (the first IP in the subnet, used to identify the network itself) is found by performing a bitwise AND operation between the IP and the Mask.

Network Address = IP Address AND Subnet Mask

Finding the Broadcast Address

The Broadcast Address (the last IP in the subnet, used to send a packet to every device simultaneously) is found by performing a bitwise OR operation with the inverted mask.

Broadcast Address = Network Address OR (NOT Subnet Mask)

Finding the Usable Host Range

The usable IP addresses you can assign to computers and printers exist between the Network and Broadcast addresses.

First Usable Host = Network Address + 1
Last Usable Host = Broadcast Address - 1
Total Usable Hosts = (2 ^ Unmasked Bits) - 2

Practical Examples

Scenario 1: The Standard Home Network (/24) You buy a standard consumer router. It assigns your laptop the IP 192.168.1.15 with a /24 subnet mask.

  • Network Address: 192.168.1.0
  • Broadcast Address: 192.168.1.255
  • Usable Range: 192.168.1.1 through 192.168.1.254 Result: Your home network can support exactly 254 simultaneous devices.

Scenario 2: The Point-to-Point Link (/30) You are configuring a direct fiber link between two enterprise routers. To prevent wasting IP addresses, you use a /30 mask on the network 10.0.0.4.

  • Total IPs: 4
  • Network Address: 10.0.0.4
  • Broadcast Address: 10.0.0.7
  • Usable Range: 10.0.0.5 and 10.0.0.6 Result: The /30 subnet perfectly supports exactly two devices (the two routers) with zero wasted IP addresses.

Key Concepts & Essential Terminology

IPv4 Subnet Mask Architecture & CIDR Bitmask Division32-Bit Dotted Quad Partitioning, Network Prefix vs Host ID, and Usable Host Capacity (2^(32-n) - 2)32-Bit Address Division: 192.168.1.0 / 2411111111 (255)11111111 (255)11111111 (255)00000000 (0)/24 BoundaryNetwork Prefix: 24 BitsHost: 8 BitsSubnet Properties (192.168.1.0/24):• Network Address: 192.168.1.0 (Routing identifier)• First Usable Host: 192.168.1.1 (Gateway router)• Last Usable Host: 192.168.1.254 (Endpoints)• Directed Broadcast: 192.168.1.255 (All-hosts wire)Usable Hosts = 2⁸ - 2 = 256 - 2 = 254 DevicesCIDR Mask & Usable Host Scale Matrix/24 (255.255.255.0)Standard Branch / LAN254 Usable Hosts/26 (255.255.255.192)Departmental Segment62 Usable Hosts/28 (255.255.255.240)Small Server Rack / DMZ14 Usable Hosts/30 (255.255.255.252)Legacy Point-to-Point WAN Link2 Usable Hosts/31 (RFC 3021 Modern P2P)Zero Host Bits (No network/broadcast lost)2 Usable Hosts (100% efficient)

In Internet Protocol version 4 (IPv4) networking, subnetting partitions a contiguous 32-bit logical address space into distinct hierarchical network segments. Subnetting enables network engineers to enforce security boundaries, restrict broadcast traffic domains, conserve scarce public IPv4 space, and optimize routing efficiency via Classless Inter-Domain Routing (CIDR) (RFC 1519) and Variable Length Subnet Masking (VLSM) (RFC 1878).

The 32-Bit Dotted-Quad Structure & Bitwise Masking

An IPv4 address consists of exactly 32 binary bits divided into four 8-bit octets separated by dots (e.g., 192.168.1.100). A subnet mask acts as a bitwise filter that separates the address into two components:

  1. Network Prefix (Routing Identifier): Contiguous leading binary 1s that identify the network and subnetwork.
  2. Host Identifier (Device Interface): Remaining trailing binary 0s that uniquely identify an interface on that specific segment.

To discover the network address, router hardware performs a hardware-level bitwise logical AND between the destination IP address and the subnet mask:

IP Address:   11000000.10101000.00000001.01100100 (192.168.1.100)
Subnet Mask:  11111111.11111111.11111111.00000000 (255.255.255.0 = /24)
-------------------------------------------------------------------
Network ID:   11000000.10101000.00000001.00000000 (192.168.1.0)

The Usable Host Capacity Formula

In conventional subnets, the number of assignable host addresses is determined by the number of host bits ($h = 32 - \text{prefix}$):

Total Addresses = 2^h = 2^(32 - prefix)
Usable Host Capacity = 2^h - 2

Two addresses are traditionally reserved by the networking stack:

  • Network Address (All host bits 0): Identifies the subnet boundary in routing tables.
  • Directed Broadcast Address (All host bits 1): Sends packets simultaneously to all active host interfaces on the local wire.

Master IPv4 CIDR Subnetting Matrix

The following reference table outlines subnet mask configurations from /16 to /32, detailing netmasks, total address blocks, usable hosts, and wildcard masks:

CIDR Prefix Subnet Mask (Dotted Quad) Binary Subnet Mask (Last Octet) Wildcard Mask Total Addresses ($2^h$) Usable Hosts ($2^h - 2$) Classful Equivalent
/16 255.255.0.0 00000000 0.0.255.255 65,536 65,534 Class B
/17 255.255.128.0 00000000 0.0.127.255 32,768 32,766 1/2 Class B
/18 255.255.192.0 00000000 0.0.63.255 16,384 16,382 1/4 Class B
/19 255.255.224.0 00000000 0.0.31.255 8,192 8,190 1/8 Class B
/20 255.255.240.0 00000000 0.0.15.255 4,096 4,094 16 Class C
/21 255.255.248.0 00000000 0.0.7.255 2,048 2,046 8 Class C
/22 255.255.252.0 00000000 0.0.3.255 1,024 1,022 4 Class C
/23 255.255.254.0 00000000 0.0.1.255 512 510 2 Class C
/24 255.255.255.0 00000000 0.0.0.255 256 254 Standard Class C
/25 255.255.255.128 10000000 0.0.0.127 128 126 1/2 Class C
/26 255.255.255.192 11000000 0.0.0.63 64 62 1/4 Class C
/27 255.255.255.224 11100000 0.0.0.31 32 30 1/8 Class C
/28 255.255.255.240 11110000 0.0.0.15 16 14 1/16 Class C
/29 255.255.255.248 11111000 0.0.0.7 8 6 Small cluster
/30 255.255.255.252 11111100 0.0.0.3 4 2 Legacy P2P link
/31 255.255.255.254 11111110 0.0.0.1 2 2 (RFC 3021) Modern P2P link
/32 255.255.255.255 11111111 0.0.0.0 1 1 (Host route) Loopback / VPN endpoint

RFC 1918 Private IPv4 Address Allocations

Internet standards define non-routable private address scopes intended for internal local-area networks (LANs), translated to public IPs via Network Address Translation (NAT):

Private Block Class CIDR Prefix Address Range Total Addresses Typical Deployment Scale
Class A Private 10.0.0.0/8 10.0.0.0 – 10.255.255.255 16,777,216 Large enterprise backbones, multi-region AWS/GCP VPCs
Class B Private 172.16.0.0/12 172.16.0.0 – 172.31.255.255 1,048,576 Corporate campuses, Docker bridge networks (172.17.0.0/16)
Class C Private 192.168.0.0/16 192.168.0.0 – 192.168.255.255 65,536 Consumer Wi-Fi routers, home offices, small business LANs
Carrier-Grade NAT 100.64.0.0/10 100.64.0.0 – 100.127.255.255 4,194,304 ISP CGNAT WAN interfaces (RFC 6598)
Link-Local (APIPA) 169.254.0.0/16 169.254.0.0 – 169.254.255.255 65,536 Auto-configuration fallback when DHCP fails (RFC 3927)

On legacy point-to-point router links, engineers utilized /30 subnets ($2^{32-30} = 4\text{ addresses}$). However, because the network ID and broadcast consumed 2 of the 4 addresses, $50%$ of assigned IPv4 space was wasted.

To eliminate this exhaustion on inter-router links, RFC 3021 established the standard for /31 subnets:

  • Total addresses: $2^1 = 2$.
  • Both addresses are treated as valid host unicast addresses (e.g., 10.0.0.0 and 10.0.0.1).
  • Directed broadcast is disabled; communication is strictly peer-to-peer.
  • Achieves $100%$ address efficiency, saving millions of IPv4 addresses globally across telecommunication carrier backbones.

For complementary network and compute tools, visit our bandwidth calculator, binary converter, and password generator.

Common IP Subnetting Mistakes to Avoid

  1. Assigning Network or Broadcast Addresses to Host Devices: The first address (Network ID) and last address (Broadcast) cannot be assigned to network interfaces.
  2. Forgetting the "Minus 2" Rule for Usable Hosts: A /30 subnet has 4 total addresses, but only 2 usable hosts (2³²⁻³⁰ - 2 = 2).
  3. Confusing CIDR Prefix Length with Subnet Mask Octets: /24 corresponds to 255.255.255.0; /27 corresponds to 255.255.255.224.
  4. Overlapping Subnet Ranges in Network Designs: Assigning overlapping IP subnets causes routing loops and IP conflict outages.
  5. Assigning Public IPv4 Addresses Internally: Using non-RFC 1918 public IP space internally prevents access to those real internet destinations.
  6. Miscalculating /31 Point-to-Point Links: RFC 3021 allows /31 for point-to-point links (2 usable hosts), but legacy devices require /30.

Frequently Asked Questions

What is subnetting and why is it used?

Subnetting divides a single large IP network into multiple smaller, logically isolated sub-networks (subnets). Network engineers subnet to reduce broadcast traffic, improve security by isolating segments, and organize devices by department, floor, or function. Without subnetting, every device on a network receives every broadcast packet, which degrades performance at scale.

What inputs does this calculator need?

Enter an IP address (IPv4, e.g., 192.168.1.0) and a subnet mask or CIDR prefix length (e.g., /24 or 255.255.255.0). The calculator returns the network address, broadcast address, usable host range, number of usable hosts, and wildcard mask — all the values required to configure routers, switches, and firewall rules.

What does the CIDR notation like /24 mean?

CIDR (Classless Inter-Domain Routing) notation expresses the subnet mask as the number of consecutive 1-bits from the left of the 32-bit address. /24 means the first 24 bits identify the network (equivalent to mask 255.255.255.0), leaving 8 bits for hosts — allowing up to 254 usable host addresses (256 minus the network and broadcast addresses).

How many usable hosts does a subnet have?

For an IPv4 subnet with a /n prefix, the total number of addresses is 2^(32-n). Two addresses are always reserved: the network address (all host bits = 0) and the broadcast address (all host bits = 1). So the number of usable host addresses is 2^(32-n) − 2. For example, a /24 subnet has 256 − 2 = 254 usable addresses.

Does this calculator support IPv6?

IPv4 subnetting and IPv6 subnetting follow the same conceptual logic (CIDR prefix notation, network/host bits), but IPv6 uses 128-bit addresses instead of 32-bit. If the calculator supports both, you can enter an IPv6 address with its prefix (e.g., 2001:db8::/32). Check the tool's input options; IPv6 support varies by implementation.

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing) notation, like /24, simply represents the number of contiguous "1" bits in the binary subnet mask. A /24 means the first 24 bits are 1s, which translates to the decimal mask 255.255.255.0.

Why do we subtract 2 from the total hosts?

In every IPv4 subnet, exactly two IP addresses are mathematically reserved and cannot be assigned to a computer. The very first IP is the Network Address (identifying the subnet itself), and the very last IP is the Broadcast Address (used for network-wide shouting).

What are Private IP Addresses (RFC 1918)?

These are specific IP ranges (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16) that are not routable on the public internet. They are designed exclusively for internal local area networks (LANs), allowing millions of homes to reuse the same 192.168.1.x addresses safely.

How does IPv6 subnetting differ?

IPv6 operates on 128-bit hexadecimal mathematics rather than 32-bit decimal math. Because IPv6 space is so unimaginably vast, traditional "host conservation" subnetting (like using a /30) is unnecessary. Almost all IPv6 LAN subnets are simply assigned a massive /64 mask.

Conclusion

Mastering IP subnetting is the absolute foundation of an IT networking career. While the binary math is excellent for understanding the theory, real-world network architects rely entirely on IP Subnet Calculators to rapidly design error-free routing tables and VLAN architectures.

Explore other useful calculators in our collection:

Sources & References

The figures, formulas, and guidance behind this IP Subnet Calculator draw on authoritative primary sources. For verification and further reading:

Technical & General Calculation Disclaimer

This calculation tool applies standard mathematical, scientific, or engineering formulas. While designed for precision, output values are estimates and should be independently verified for commercial, structural, or safety-critical applications.

Comments

Sign in to leave a comment.

Loading comments…