Home
Enter a valid IPv4 address.
Input Format:
/0 to /32
Example: /24 = 255.255.255.0
Enter a valid subnet mask.
Example: 255.255.255.0 = /24
Display IP addresses in binary format.
Display a quick reference CIDR to subnet mask table.
Display the formula used in the breakdown.

What Is Subnetting?

Subnetting is the process of dividing a large network into smaller, more manageable subnetworks (subnets). It improves network performance, security, and simplifies management. Each subnet has its own network address and range of usable IP addresses.

The subnet mask (or netmask) is a 32-bit number that determines which portion of an IP address identifies the network and which portion identifies the host. For example, the subnet mask 255.255.255.0 means the first 24 bits are the network portion, and the last 8 bits are the host portion. This is represented in CIDR notation as /24[reference:0].

How the Subnet Mask Calculator Works

The calculator performs the following steps to compute subnet details:

Step 1: Convert the subnet mask or CIDR prefix to its binary form.

Step 2: Apply the mask to the IP address using a bitwise AND operation to get the Network Address.

Step 3: Apply the wildcard mask (inverse of the subnet mask) to get the Broadcast Address.

Step 4: Calculate the usable host range (first host = network + 1, last host = broadcast - 1).

Step 5: Compute the total number of hosts (2host bits) and usable hosts (total hosts - 2).

The wildcard mask is the inverse of the subnet mask (0.0.0.255 for /24) and is often used in access control lists (ACLs) and routing protocols.

Why Use This Subnet Mask Calculator?

  • Fast & Accurate: Get instant results without manual calculations.
  • Two Input Modes: Enter CIDR prefix or subnet mask.
  • Comprehensive Results: Network address, broadcast, host range, total hosts, wildcard mask, and binary representation.
  • Visual Breakdown: A chart and detailed table show all subnet properties.
  • Free & Private: No registration, no data storage.

Common CIDR Prefixes

  • /32: 255.255.255.255 — Single host (1 address)
  • /30: 255.255.255.252 — 4 addresses (2 usable hosts, common for point-to-point links)
  • /29: 255.255.255.248 — 8 addresses (6 usable hosts)
  • /28: 255.255.255.240 — 16 addresses (14 usable hosts)
  • /27: 255.255.255.224 — 32 addresses (30 usable hosts)
  • /26: 255.255.255.192 — 64 addresses (62 usable hosts)
  • /25: 255.255.255.128 — 128 addresses (126 usable hosts)
  • /24: 255.255.255.0 — 256 addresses (254 usable hosts, standard Class C)
  • /23: 255.255.254.0 — 512 addresses (510 usable hosts)
  • /22: 255.255.252.0 — 1,024 addresses (1,022 usable hosts)
  • /21: 255.255.248.0 — 2,048 addresses (2,046 usable hosts)
  • /20: 255.255.240.0 — 4,096 addresses (4,094 usable hosts)
  • /16: 255.255.0.0 — 65,536 addresses (65,534 usable hosts, standard Class B)
  • /8: 255.0.0.0 — 16,777,216 addresses (16,777,214 usable hosts, standard Class A)

❓ Subnet Mask Calculator FAQ

What is a subnet mask?

A subnet mask is a 32-bit number that separates an IP address into network and host portions. It determines which part of the IP address identifies the network and which part identifies the host. For example, 255.255.255.0 means the first 24 bits are the network portion.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation is a compact way to represent a subnet mask. It uses a slash followed by the number of network bits. For example, /24 means the first 24 bits are the network portion, which is equivalent to 255.255.255.0.

How do I convert a subnet mask to CIDR?

Count the number of consecutive 1s in the binary representation of the subnet mask. For example, 255.255.255.0 in binary is 11111111.11111111.11111111.00000000, which has 24 ones, so the CIDR is /24.

What is a network address?

The network address (or network ID) 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.

What is a broadcast address?

The broadcast address is the last address in a subnet. It is used to send data to all hosts on the subnet. It is calculated by setting all host bits to 1. For example, in 192.168.1.0/24, the broadcast address is 192.168.1.255.

What is a usable host range?

The usable host range is the range of IP addresses that can be assigned to devices on the subnet. It excludes the network address and the broadcast address. For example, in 192.168.1.0/24, the usable range is 192.168.1.1 to 192.168.1.254.

How do I calculate the number of hosts in a subnet?

Total hosts = 2^(32 - CIDR). Usable hosts = Total hosts - 2 (for network and broadcast addresses). For example, /24 gives 2^8 = 256 total addresses, with 254 usable hosts.

What is a wildcard mask?

A wildcard mask is the inverse of a subnet mask. It is used in access control lists (ACLs) and routing protocols like OSPF and EIGRP. For example, the wildcard mask for 255.255.255.0 is 0.0.0.255.

What is the difference between IPv4 and IPv6 subnetting?

IPv4 uses 32-bit addresses and is the focus of this calculator. IPv6 uses 128-bit addresses and has a different subnetting structure. This calculator is for IPv4 only.

Can I use this calculator for classful addressing?

Yes. This calculator supports both classful and classless addressing. Classful networks (Class A, B, C) have fixed subnet masks (/8, /16, /24). Classless addressing (CIDR) allows for flexible subnet sizes.

What is the purpose of subnetting?

Subnetting divides a large network into smaller, more manageable subnetworks. It improves network performance by reducing broadcast traffic, enhances security by isolating network segments, and simplifies network management.

What is VLSM?

VLSM (Variable Length Subnet Mask) is a technique that allows you to use different subnet masks within the same network, optimizing IP address allocation. This calculator focuses on basic subnet mask calculation; for VLSM, please use our VLSM Calculator.

How does the calculator handle invalid IP addresses?

The calculator validates the IP address format and ensures it's a valid IPv4 address. It also validates the subnet mask and CIDR prefix. If invalid input is detected, an error message will be shown.

What is the purpose of the binary representation?

Binary representation helps you understand how subnetting works at the bit level. It shows the network bits and host bits, making it easier to see how the subnet mask divides the IP address.

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

A subnet mask has 1s in the network portion and 0s in the host portion (e.g., 255.255.255.0). A wildcard mask is the inverse, with 0s in the network portion and 1s in the host portion (e.g., 0.0.0.255).

How accurate is this subnet mask calculator?

This calculator provides accurate results based on standard subnetting formulas. It is designed for educational and planning purposes. For production networks, always verify with your network equipment and documentation.

What is the maximum number of hosts in a subnet?

The maximum number of hosts in a single subnet is 2^32 - 2 = 4,294,967,294 for a /0 network. However, in practice, such large subnets are not used. The calculator supports CIDR prefixes from /0 to /32.

Can I use this calculator for IPv6?

No. This calculator is for IPv4 only. IPv6 subnetting uses a different addressing structure and is not supported in this tool.