Other

IP Subnet Calculator

Results

Enter values and calculate to see results.

Embed on your site

Any ezcalcs calculator can be embedded with one script tag. Copy the snippet below or use the homepage playground to preview and customize.

<!-- ezcalcs embed: ip-subnet-calculator — paste anywhere in the body -->
<script
  async
  src="https://ezcalcs.net/embed.js"
  data-calc="ip-subnet-calculator"
  data-theme="light"
  data-width="100%"
  data-height="640"
></script>

IP Subnet Calculator

Enter an IP address and a subnet mask or CIDR prefix length. This IP subnet calculator returns the network address, broadcast address, usable host range, wildcard mask, and the number of subnets and hosts your configuration supports.

It works for both IPv4 and IPv6. Whether you are dividing a network into smaller networks or verifying a CIDR block, the calculator handles the binary math so you can focus on planning.

How to Calculate IP Address Subnets

Subnetting is the process of dividing a network into smaller subnetworks. Each subnet gets its own range of IP addresses, its own network address, and its own broadcast address.

Here is how the math works at a high level:

  1. Start with an IP address in dotted decimal (like 192.168.1.0) or IPv6 hex notation.
  2. Choose a subnet mask or CIDR prefix length that defines how many bits belong to the network part.
  3. The remaining bits belong to the host part. Those bits set the maximum number of host addresses per subnet.

The calculator does this for you. Type in the address and mask, and it returns every result instantly. No manual binary conversion needed.

What makes subnetting tricky? The difficulty comes from thinking in powers of two. Subnet boundaries fall on binary values, not round decimal numbers. A /26 mask gives you 62 usable hosts, not 64, because one address is reserved for the network and one for the broadcast. This calculator eliminates that mental math.

Subnet Mask and Mask Bits

A subnet mask is a 32-bit number (in IPv4) that separates the network part of an IP address from the host part. Ones in the mask mark network bits. Zeros mark host bits.

For example, the mask 255.255.255.0 in binary is 24 ones followed by 8 zeros. That means 24 mask bits define the network, and 8 bits are left for hosts.

Common subnet masks and their mask bits:

  • 255.0.0.0 = 8 mask bits (/8)
  • 255.255.0.0 = 16 bits (/16)
  • 255.255.255.0 = 24 bits (/24)
  • 255.255.255.128 = 25 bits (/25)
  • 255.255.255.192 = 26 bits (/26)
  • 255.255.255.252 = 30 bits (/30)

The more mask bits you use, the fewer hosts per subnet, and the more subnets you can create from a given address block.

CIDR Notation and Subnet Bits

CIDR stands for classless inter-domain routing. It replaced the old class-based system with a simple slash notation that tells you exactly how many bits form the routing prefix.

An address written as 10.0.0.0/16 means the first 16 bits are the network prefix and the remaining 16 bits are available for hosts. The number after the slash is the CIDR number, also called the prefix length.

Subnet bits are the bits you "borrow" from the default host portion when you subdivide a network into smaller blocks. If a Class B network starts at /16 and you subnet it to /20, you have borrowed 4 subnet bits, creating 2⁴ = 16 subnets.

CIDR notation makes subnetting clearer than writing out full dotted-decimal masks. This calculator accepts either format and converts between them automatically.

IPv4 Subnet Calculator

The IPv4 portion of this calculator takes a 32-bit IPv4 address and a mask (dotted decimal or CIDR) and returns:

  • Network address
  • Broadcast address
  • First and last usable host addresses
  • Total number of hosts and usable hosts
  • Wildcard mask
  • Network class (if applicable)
  • Binary representation of each octet

Network Class in IPv4 Subnetting

Before CIDR, IPv4 addresses were grouped into classes based on the leading bits of the first octet:

  • Class A: 1.0.0.0 to 126.0.0.0, default subnet mask /8
  • Class B: 128.0.0.0 to 191.255.0.0, default subnet mask /16
  • Class C: 192.0.0.0 to 223.255.255.0, default subnet mask /24

Modern networking is classless. Routers use the prefix length, not the class, to make forwarding decisions. Still, understanding network class helps when reading older documentation or studying for a Cisco exam. The calculator shows the class for reference.

Broadcast Address and Host Address

Every subnet has two reserved addresses. The network address has all host bits set to zero. The broadcast address has all host bits set to one.

The usable host range falls between those two. For a /24 subnet (256 total addresses), you get 254 usable host addresses. For a /30 subnet, you get just 2 usable hosts, which is common for point-to-point router links.

This calculator displays the full host range so you know exactly which addresses you can assign.

Wildcard Mask

A wildcard mask is the inverse of the subnet mask. Where the subnet mask has a 1, the wildcard mask has a 0, and vice versa.

For a subnet mask of 255.255.255.0, the wildcard mask is 0.0.0.255.

Wildcard masks are used in router access control lists (ACLs) and some routing protocol configurations. They tell the device which bits to check and which to ignore. The calculator outputs the wildcard mask alongside the subnet mask so you can copy it directly into your configuration.

Octet and Binary in IPv4

An IPv4 address is four octets. Each octet is 8 bits, giving 32 bits total. The decimal value of each octet ranges from 0 to 255.

Understanding the binary values behind each octet makes subnet boundaries intuitive. For example, 255.255.255.192 in binary is:

11111111.11111111.11111111.11000000

The two zeros at the end mean 2² = 4 host combinations, or 2 usable hosts per subnet. The calculator shows the binary breakdown for every input so you can see exactly where the network part ends and the host part begins.

IPv6 Subnets

IPv6 uses 128-bit addresses instead of 32-bit. The much larger address space means subnetting works at a different scale, but the core concept is the same: a prefix length separates network bits from host bits.

A typical IPv6 subnet uses a /64 prefix, leaving 64 bits for host identifiers. That is over 18 quintillion addresses per subnet. Organizations usually receive a /48 block from their provider, giving them 16 bits (65,536 possible subnets) to divide internally.

Enter an IPv6 address and prefix length, and the calculator returns the network prefix, the full address range, and the number of subnets available at your chosen prefix length.

Hex in IPv6 Subnetting

IPv6 addresses are written in hexadecimal (hex), grouped into eight blocks of 16 bits separated by colons. For example:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

Each hex digit represents 4 bits. Subnet boundaries in IPv6 almost always land on 4-bit (nibble) boundaries, which keeps the math clean. A /48 prefix means the first 12 hex digits are the network portion.

The calculator handles hex-to-binary conversion and displays results in standard compressed IPv6 notation.

IPv4 and IPv6 Subnets: IP Calculator for Both

Most networks today run IPv4 and IPv6 side by side. This IP calculator supports both protocols in one tool.

Key differences to keep in mind:

FeatureIPv4IPv6
Address length32 bits (4 octets)128 bits (8 groups of 16 bits)
NotationDotted decimalHexadecimal with colons
Common subnet/24 (256 addresses)/64 (huge address space)
Broadcast addressYesNo (uses multicast instead)

You do not need to switch between separate tools. Enter either address type and the calculator detects the protocol and adjusts its output.

Subnetting and Network Address

The network address is the first address in any subnet. It identifies the subnet itself and cannot be assigned to a host.

When you are creating subnets from a larger block, each new subnet gets its own network address. For example, splitting 10.0.0.0/24 into four /26 subnets produces:

  • 10.0.0.0/26 (network address: 10.0.0.0)
  • 10.0.0.64/26 (network address: 10.0.0.64)
  • 10.0.0.128/26 (network address: 10.0.0.128)
  • 10.0.0.192/26 (network address: 10.0.0.192)

Each subnet has 62 usable host addresses. The calculator lists every subnet boundary, network address, and host range when you divide a network.

Supernetting (also called route aggregation) works in reverse: combining smaller networks into a single larger routing prefix. The same prefix-length math applies, just in the other direction.

What This IP Calculator Can Calculate

This free IP subnet calculator handles the following:

  • Subnet mask to CIDR conversion and CIDR to subnet mask
  • Network address and broadcast address for any given IP and mask
  • Usable host range (first and last assignable addresses)
  • Wildcard mask for router and firewall configuration
  • Number of subnets when subdividing a larger block
  • Number of usable hosts per subnet
  • Binary and decimal representations of IPv4 addresses and masks
  • IPv6 prefix calculation with hex notation
  • Network class identification for IPv4 addresses

It is a planning and troubleshooting aid. Use it when designing a new IP network, verifying a CIDR block, or double-checking a subnet mask before applying a configuration.

What This Subnet Calculator Does Not Replace

This calculator gives you accurate subnet math based on the values you enter. It does not replace:

  • A network engineer's judgment. Subnetting decisions depend on traffic patterns, growth plans, VLAN design, and security requirements that no calculator can evaluate for you.
  • Your router or firewall configuration tool. Copy the results into your device configs, but always verify in a lab or staging environment first.
  • Professional network auditing. If you are troubleshooting production outages or planning enterprise-scale addressing, work with a qualified network professional.

Use the results as a starting point for planning. The math is precise, but how you apply it depends on your specific network.