IP Subnet Calculator

Network subnetting tool • 2026 edition

Subnet Calculation Formulas:

Calculate Network

CIDR Notation: /n where n is the number of network bits

Subnet Mask: 255.255.255.(256 - 2^(8-n)) for classless addressing

Where:

  • Number of Subnets: \(2^{(subnet\_bits)}\)
  • Hosts per Subnet: \(2^{(host\_bits)} - 2\)
  • Subnet Block Size: \(256 - subnet\_mask\_octet\)
  • Valid Host Range: Network + 1 to Broadcast - 1

These formulas calculate network parameters based on CIDR notation or subnet mask. The CIDR notation represents the number of bits used for the network portion of an IP address.

Example: For IP 192.168.1.0 with /24:

Network Bits: 24, Host Bits: 8

Subnet Mask: 255.255.255.0

Subnets: \(2^0 = 1\), Hosts per subnet: \(2^8 - 2 = 254\)

Network Input

Advanced Options

Network Results

Network Address
192.168.1.0
Broadcast Address
192.168.1.255
Usable IPs
254
Subnet Mask
255.255.255.0
IP: 11000000.10101000.00000001.00000000
SM: 11111111.11111111.11111111.00000000
Network Diagram
Network: 192.168.1.0/24
Range: 192.168.1.1 - 192.168.1.254
Subnet Mask: 255.255.255.0
Total Addresses: 256
Usable Hosts: 254
Calculation Steps

Step 1: Convert IP address to binary: 192.168.1.0 → 11000000.10101000.00000001.00000000

Step 2: Convert subnet mask to binary: 255.255.255.0 → 11111111.11111111.11111111.00000000

Step 3: Perform bitwise AND operation to find network address

Step 4: Calculate host bits: 32 - 24 = 8 bits

Step 5: Calculate usable hosts: 2^8 - 2 = 254 hosts

Hosts per subnet = 2^(32-CIDR) - 2 = 2^8 - 2 = 254
Parameter Value
Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable IP192.168.1.1
Last Usable IP192.168.1.254
Subnet Mask255.255.255.0
CIDR Notation/24
Wildcard Mask0.0.0.255
Number of Hosts256
Usable Hosts254

IP Subnetting Fundamentals

What is IP Subnetting?

IP subnetting is the process of dividing a larger IP network into smaller subnetworks to optimize network performance and security.

Subnetting Formula

Subnets = \(2^n\), Hosts = \(2^m - 2\)

Where n = borrowed bits, m = remaining host bits.

Key Rules:
  • Subnet mask defines network/host boundary
  • First and last IP addresses are reserved
  • CIDR notation simplifies subnet representation
  • Always borrow bits from host portion

Network Classes

IP Address Classes

Class A: 1-126, Class B: 128-191, Class C: 192-223, Class D: 224-239 (Multicast), Class E: 240-255 (Reserved)

Class Characteristics
  1. Class A: 8 network bits, 24 host bits
  2. Class B: 16 network bits, 16 host bits
  3. Class C: 24 network bits, 8 host bits
  4. Classes define default subnet masks
Considerations:
  • Classful addressing is largely deprecated
  • CIDR allows flexible subnetting
  • Private ranges: 10.x.x.x, 172.16-31.x.x, 192.168.x.x
  • Subnet zero is now allowed

IP Subnetting Learning Quiz

Question 1: Multiple Choice - Subnet Calculations

For the IP address 172.16.0.0 with subnet mask 255.255.240.0, how many usable host addresses are available per subnet?

Solution:

The answer is B) 4094. First, convert the subnet mask 255.255.240.0 to binary: 11111111.11111111.11110000.00000000. This shows 20 network bits and 12 host bits. Using the formula 2^12 - 2 = 4096 - 2 = 4094 usable host addresses.

Pedagogical Explanation:

To calculate usable hosts, count the number of zeros in the subnet mask's binary representation. These zeros represent the host bits. Then apply the formula: 2^(number of host bits) - 2 (subtracting 2 for network and broadcast addresses).

Key Definitions:

Subnet Mask: Defines network/host boundary in IP address

Host Bits: Portion of IP address for individual devices

Usable Hosts: Available addresses excluding network/broadcast

Important Rules:

• Count zeros in subnet mask binary to find host bits

• Always subtract 2 from total addresses

• Formula: 2^(host bits) - 2 = usable hosts

Tips & Tricks:

• Remember: 240 in binary is 11110000

• Powers of 2: 2^10 = 1024, 2^11 = 2048, 2^12 = 4096

Common Mistakes:

• Forgetting to subtract 2 for network/broadcast addresses

• Miscounting the number of host bits

Question 2: Detailed Answer - VLSM Subnetting

Given a network 192.168.10.0/24, subnet it using VLSM to create networks for 60, 30, 12, and 2 hosts respectively. Show the network addresses and subnet masks.

Solution:

For VLSM subnetting, allocate larger subnets first:

For 60 hosts: Need 6 host bits (2^6 - 2 = 62 hosts). Use /26 (255.255.255.192)

Network: 192.168.10.0/26, Range: 192.168.10.1 - 192.168.10.62

For 30 hosts: Need 5 host bits (2^5 - 2 = 30 hosts). Use /27 (255.255.255.224)

Network: 192.168.10.64/27, Range: 192.168.10.65 - 192.168.10.94

For 12 hosts: Need 4 host bits (2^4 - 2 = 14 hosts). Use /28 (255.255.255.240)

Network: 192.168.10.96/28, Range: 192.168.10.97 - 192.168.10.110

For 2 hosts: Need 2 host bits (2^2 - 2 = 2 hosts). Use /30 (255.255.255.252)

Network: 192.168.10.112/30, Range: 192.168.10.113 - 192.168.10.114

Pedagogical Explanation:

VLSM (Variable Length Subnet Masking) allows efficient IP address allocation by assigning subnet sizes based on actual needs. Always allocate the largest subnets first to prevent fragmentation. Calculate host bits needed: round up to next power of 2, then subtract 2 for network and broadcast addresses.

Key Definitions:

VLSM: Variable Length Subnet Masking - allows different subnet sizes

Subnetting: Dividing a network into smaller segments

Efficient Allocation: Minimizing IP address waste

Important Rules:

• Allocate largest subnets first in VLSM

• Use next power of 2 for host requirements

• Always subtract 2 for network/broadcast addresses

Tips & Tricks:

• Memorize powers of 2: 2, 4, 8, 16, 32, 64, 128, 256

• Use the formula: 2^(host bits) - 2 = usable hosts

Common Mistakes:

• Allocating small subnets first causing fragmentation

• Forgetting to round up to next power of 2

IP Subnet Calculator

IP Subnetting FAQ

Q: What's the difference between CIDR and subnet masking, and why is CIDR preferred?

A: Subnet masking uses dotted decimal notation (e.g., 255.255.255.0) to define network boundaries, while CIDR (Classless Inter-Domain Routing) uses prefix notation (e.g., /24).

CIDR is preferred because it:

1. Eliminates classful addressing limitations - no more rigid Class A/B/C boundaries

2. Enables route aggregation - reduces routing table size

3. Allows variable-length subnetting - more efficient IP allocation

4. Simplifies configuration - shorter notation

For example, 255.255.255.0 is equivalent to /24 in CIDR notation. Both represent 24 network bits and 8 host bits.

Q: Why do we subtract 2 from the total number of host addresses in a subnet?

A: We subtract 2 from the total host addresses because:

1. Network Address (first address) - identifies the subnet itself and cannot be assigned to a device

2. Broadcast Address (last address) - used for broadcasting to all devices in the subnet and cannot be assigned to a device

For example, in a /24 subnet (256 total addresses):

- Network Address: 192.168.1.0 (reserved)

- Usable Hosts: 192.168.1.1 to 192.168.1.254 (254 addresses)

- Broadcast Address: 192.168.1.255 (reserved)

This rule applies to all subnet sizes regardless of the subnet mask.

About

Networking Team
This calculator was created
This calculator was created by our General & Utility Calculators Team , may make errors. Consider checking important information. Updated: April 2026.