Ip Calculator

IP Subnet Calculator
. . .
/32 (255.255.255.255) – 1 Host/31 (255.255.255.254) – 2 Hosts/30 (255.255.255.252) – 4 Hosts/29 (255.255.255.248) – 8 Hosts/28 (255.255.255.240) – 16 Hosts/27 (255.255.255.224) – 32 Hosts/26 (255.255.255.192) – 64 Hosts/25 (255.255.255.128) – 128 Hosts/24 (255.255.255.0) – 256 Hosts/23 (255.255.254.0) – 512 Hosts/22 (255.255.252.0) – 1,024 Hosts/21 (255.255.248.0) – 2,048 Hosts/20 (255.255.240.0) – 4,096 Hosts/19 (255.255.224.0) – 8,192 Hosts/18 (255.255.192.0) – 16,384 Hosts/17 (255.255.128.0) – 32,768 Hosts/16 (255.255.0.0) – 65,536 Hosts/8 (255.0.0.0) – 16.7M Hosts
Network Address:
Usable Host Range:
Broadcast Address:
Total Number of Hosts:
Usable Number of Hosts:
Subnet Mask:
Wildcard Mask:
Enter IP details and click Calculate to see results
function calculateSubnet(){var o1=parseInt(document.getElementById('oct1').value);var o2=parseInt(document.getElementById('oct2').value);var o3=parseInt(document.getElementById('oct3').value);var o4=parseInt(document.getElementById('oct4').value);var cidr=parseInt(document.getElementById('cidr').value);if(isNaN(o1)||isNaN(o2)||isNaN(o3)||isNaN(o4)||o1255||o2255||o3255||o4255){alert('Please enter valid IP address octets (0-255).');return;}var ipInt=((o1<>0)|(o2<<16)|(o3<<8)|o4;var maskInt=(cidr==0)?0:(0xFFFFFFFF<>>0;var netInt=ipInt&maskInt;var broadInt=netInt|(~maskInt);function intToIp(i){return((i>>>24)&255)+'.'+((i>>>16)&255)+'.'+((i>>>8)&255)+'.'+(i&255);}var netAddr=intToIp(netInt);var broadAddr=intToIp(broadInt);var maskAddr=intToIp(maskInt);var wildAddr=intToIp(~maskInt);var totalHosts=Math.pow(2,32-cidr);var usableHosts=(totalHosts>2)?totalHosts-2:(totalHosts==2)?2:1;var firstHost=intToIp(netInt+1);var lastHost=intToIp(broadInt-1);if(cidr==31){firstHost=intToIp(netInt);lastHost=intToIp(broadInt);}if(cidr==32){firstHost=intToIp(netInt);lastHost=intToIp(netInt);}document.getElementById('resNet').innerHTML=netAddr;document.getElementById('resBroad').innerHTML=broadAddr;document.getElementById('resMask').innerHTML=maskAddr;document.getElementById('resWild').innerHTML=wildAddr;document.getElementById('resTotal').innerHTML=totalHosts.toLocaleString();document.getElementById('resUsable').innerHTML=usableHosts.toLocaleString();document.getElementById('resRange').innerHTML=(cidr<=30)?firstHost+' – '+lastHost:netAddr;document.getElementById('answer').style.display='block';document.getElementById('placeholder').style.display='none';}

Calculator Use

This ip calculator is a professional tool designed for network engineers, system administrators, and students to quickly determine network parameters from an IPv4 address and a subnet mask (CIDR). By entering a specific IP address and choosing a prefix length, you can calculate the network boundaries, broadcast address, and the total number of usable host addresses available in a specific subnet.

Whether you are setting up a home router, configuring a corporate VLAN, or studying for a Cisco CCNA exam, this tool provides the essential data required to segment networks effectively.

IP Address
The 32-bit identifier for a device on a TCP/IP network, expressed in four decimal octets separated by dots (e.g., 192.168.1.1).
Subnet Mask (CIDR)
Classless Inter-Domain Routing (CIDR) notation represents the number of leading 1-bits in the mask. A /24 mask means the first 24 bits are for the network and the remaining 8 bits are for hosts.
Network Address
The first address in the subnet, used to identify the entire network. It cannot be assigned to a host.

How It Works

The ip calculator performs bitwise logical operations between the IP address and the subnet mask to derive the results. In computing, an IP address is converted into its binary equivalent. The subnet mask acts as a "filter" that separates the network portion of the address from the host portion.

Network Address = (IP Address) AND (Subnet Mask)

The logic follows these steps:

  • Step 1: Convert each octet of the IP address and mask to 8-bit binary numbers.
  • Step 2: Perform a bitwise AND operation to find the Network Address.
  • Step 3: Perform a bitwise NOT on the mask (Wildcard mask) and OR it with the network address to find the Broadcast Address.
  • Step 4: Calculate host range by identifying addresses between the Network and Broadcast addresses.

Calculation Example

Example: You are given the IP address 10.0.0.5 with a CIDR of /26. You need to find the network and host capacity.

Step-by-step solution:

  1. IP Address: 10.0.0.5
  2. CIDR: /26 (Mask: 255.255.255.192)
  3. Binary IP (Last Octet): 00000101 (5)
  4. Binary Mask (Last Octet): 11000000 (192)
  5. Network Calculation: 00000101 AND 11000000 = 00000000 (0)
  6. Network Address: 10.0.0.0
  7. Broadcast Calculation: Network bits + 1s in host portion = 00111111 (63)
  8. Broadcast Address: 10.0.0.63
  9. Host Range: 10.0.0.1 to 10.0.0.62
  10. Usable Hosts: 2^(32-26) – 2 = 64 – 2 = 62 hosts

Common Questions

What is a CIDR notation?

CIDR stands for Classless Inter-Domain Routing. It replaces the old "Class A, B, C" system with a more flexible method of allocating IP addresses. The number after the slash indicates how many bits are used for the network identity.

Why subtract 2 from total hosts?

In a standard subnet, the first address is the Network Address (identifying the wire) and the last address is the Broadcast Address (used to send data to all devices in the subnet). Since these two addresses have special roles, they cannot be assigned to individual devices like PCs or printers.

Is a /24 always 255.255.255.0?

Yes, in IPv4 networking, a /24 prefix length consistently represents a subnet mask of 255.255.255.0. This is the most common mask for home and small office networks, providing 254 usable host addresses.

Leave a Comment