Oh MyUtils

IP Subnet Calculator - IPv4 & IPv6 CIDR Calculator Online

Calculate subnet masks, network addresses, broadcast addresses, and IP ranges for IPv4 and IPv6. Free online CIDR calculator — 100% client-side, no data sent to server.

Calculation Results

Network Address
192.168.1.0
Broadcast Address
192.168.1.255
Subnet Mask
255.255.255.0
Wildcard Mask
0.0.0.255
CIDR Notation
/24
First Usable Host
192.168.1.1
Last Usable Host
192.168.1.254
Total Addresses
256
Usable Hosts
254
IP Class
Class C
Address Type
Private (RFC 1918)

Frequently Asked Questions

What is an IP Subnet Calculator and what does it do?

An IP Subnet Calculator is a tool that takes an IP address and a subnet mask (or CIDR prefix length) and computes detailed network information. It calculates the network address, broadcast address, usable host range, total number of addresses, wildcard mask, and IP class. It works for both IPv4 (32-bit) and IPv6 (128-bit) addresses. Network engineers use it to plan IP allocation, design subnets, configure routers and firewalls, and troubleshoot connectivity issues.

How do I use this IP Subnet Calculator tool?

Select the IPv4 or IPv6 tab depending on your network protocol. Enter an IP address (e.g., 192.168.1.100 for IPv4 or 2001:db8::1 for IPv6). Enter the CIDR prefix length (e.g., 24 for IPv4 or 64 for IPv6). Results are calculated instantly showing network address, broadcast address, usable host range, and more. Click the copy button next to any result to copy it to your clipboard, or use Copy All to get the full results.

Is my data safe? Does it get sent to a server?

Absolutely safe. This IP Subnet Calculator runs 100% in your browser using client-side JavaScript. No IP addresses, subnet calculations, or any other data is ever transmitted to any server. All arithmetic is performed locally using JavaScript bitwise operations (for IPv4) and BigInt (for IPv6). You can safely calculate subnets for your production networks without any privacy concerns.

What is CIDR notation and how does it relate to subnet masks?

CIDR (Classless Inter-Domain Routing) notation is a compact way to represent an IP address and its associated network prefix. It is written as IP/prefix (e.g., 192.168.1.0/24). The prefix number indicates how many leading bits of the address define the network portion. For IPv4, a /24 prefix corresponds to the subnet mask 255.255.255.0 (24 bits set to 1, 8 bits set to 0). CIDR replaced the older classful addressing system and allows more flexible and efficient allocation of IP address space.

What is the difference between IPv4 and IPv6 subnetting?

IPv4 uses 32-bit addresses (e.g., 192.168.1.1) with prefix lengths from /0 to /32, supporting about 4.3 billion total addresses. IPv6 uses 128-bit addresses (e.g., 2001:db8::1) with prefix lengths from /0 to /128, supporting an astronomically larger address space (approximately 3.4 × 10^38 addresses). IPv4 subnets have network and broadcast addresses that reduce usable hosts by 2, while IPv6 does not use broadcast addresses (it uses multicast instead). The standard IPv6 subnet size is /64, which provides 2^64 (about 18.4 quintillion) addresses per subnet.

What is a wildcard mask and when is it used?

A wildcard mask is the bitwise inverse of a subnet mask. For example, if the subnet mask is 255.255.255.0, the wildcard mask is 0.0.0.255. Wildcard masks are primarily used in Cisco IOS router configurations for access control lists (ACLs) and OSPF routing protocol configurations. A 0 bit in the wildcard mask means 'must match,' while a 1 bit means 'do not care.' This tool calculates the wildcard mask automatically alongside the subnet mask.

What are private IP addresses and how do I identify them?

Private IP addresses are reserved ranges defined by RFC 1918 that are not routable on the public internet. They are used within local networks (home, office, data centers). The three private IPv4 ranges are: 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). This tool automatically detects and labels whether an entered IPv4 address is private or public, helping you verify your network configuration.

Code Examples

// IP Subnet Calculator in JavaScript

function ipv4ToInt(ip) {
  const parts = ip.split('.').map(Number);
  return ((parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3]) >>> 0;
}

function intToIpv4(num) {
  return [
    (num >>> 24) & 0xFF,
    (num >>> 16) & 0xFF,
    (num >>> 8) & 0xFF,
    num & 0xFF,
  ].join('.');
}

function calculateSubnet(ip, cidr) {
  const ipInt = ipv4ToInt(ip);
  const mask = cidr === 0 ? 0 : (~0 << (32 - cidr)) >>> 0;
  const wildcard = (~mask) >>> 0;
  const network = (ipInt & mask) >>> 0;
  const broadcast = (network | wildcard) >>> 0;
  const totalAddresses = Math.pow(2, 32 - cidr);
  const usableHosts = cidr >= 31 ? (cidr === 32 ? 1 : 2) : totalAddresses - 2;

  return {
    networkAddress: intToIpv4(network),
    broadcastAddress: intToIpv4(broadcast),
    subnetMask: intToIpv4(mask),
    wildcardMask: intToIpv4(wildcard),
    firstUsable: intToIpv4(cidr >= 31 ? network : network + 1),
    lastUsable: intToIpv4(cidr >= 31 ? broadcast : broadcast - 1),
    totalAddresses,
    usableHosts,
  };
}

// Example
const result = calculateSubnet('192.168.1.100', 24);
console.log('Network:', result.networkAddress);    // 192.168.1.0
console.log('Broadcast:', result.broadcastAddress); // 192.168.1.255
console.log('Mask:', result.subnetMask);            // 255.255.255.0
console.log('Hosts:', result.usableHosts);          // 254

Related Tools