IP Address Calculator

Calculate IP subnet information including network address, broadcast address, host range, and more.

Input

Subnet Mask: 255.255.255.0

Network Information

192.168.1.0/24

254 usable hosts

Subnet Details

IP Address
192.168.1.100
Subnet Mask
255.255.255.0
Network Address
192.168.1.0
Broadcast Address
192.168.1.255
First Host
192.168.1.1
Last Host
192.168.1.254
Wildcard Mask
0.0.0.255

IP Class

C

Type

Private

Binary Representation

IP: 11000000.10101000.00000001.01100100

Mask: 11111111.11111111.11111111.00000000

What Is IP Address Subnetting?

Every device connected to a network needs an IP address — a unique numerical label that identifies it and allows data to be routed correctly. An IPv4 address consists of 32 bits written as four decimal numbers (octets) separated by dots, for example 192.168.1.100. Each octet can range from 0 to 255, giving roughly 4.3 billion possible addresses in total.

Subnetting is the practice of dividing a large IP address space into smaller, logically organized networks called subnets. Instead of treating all 4.3 billion addresses as a flat pool, network engineers use a subnet mask to indicate which portion of an IP address identifies the network and which portion identifies the individual host within that network. This hierarchical approach makes routing more efficient, contains broadcast traffic, improves security, and helps organizations allocate addresses without waste.

The subnet mask is also a 32-bit number written in dotted-decimal form. A mask of 255.255.255.0 means the first 24 bits represent the network portion and the remaining 8 bits represent host addresses. When the mask is applied to an IP address using a bitwise AND operation, the result is the network address — the identifier for the entire subnet. The complementary bits of the mask form the wildcard mask, which reveals how many host addresses exist in the subnet.

Understanding subnetting is fundamental to network design, server administration, cloud infrastructure, and security configuration. Whether you are setting up a home lab, configuring a corporate LAN, or planning VLAN segmentation in a data center, a reliable IP address calculator saves time and eliminates arithmetic errors that could disrupt connectivity.

CIDR Notation and Subnet Masks

Classless Inter-Domain Routing (CIDR) notation is a compact way to express an IP address together with its subnet mask. It appends a forward slash and a number to the IP address, such as 192.168.1.0/24. The number after the slash is the CIDR prefix length — it tells you how many of the 32 bits in the address are devoted to the network portion.

The prefix length maps directly to a subnet mask. A /24 prefix means 24 network bits, producing the mask 255.255.255.0. A /16 gives 255.255.0.0, and a /8 gives 255.0.0.0. You can convert any prefix length to its mask by setting the leftmost N bits to 1 and the remaining bits to 0, then reading the result as four octets. The calculator does this automatically using the expression (~0 << (32 - cidr)) >>> 0.

CIDR replaced the older classful system — which rigidly divided addresses into Class A, B, and C blocks — because it allows far more flexible allocation. An ISP can assign a /22 block (1,022 usable hosts) to a small business without wasting thousands of addresses. Organizations can further subnet that /22 into smaller /24, /26, or /30 blocks to match actual department sizes.

The table below lists the most common CIDR prefix lengths with their equivalent subnet masks and usable host counts:

CIDR Subnet Mask Usable Hosts Common Use
/8255.0.0.016,777,214Large ISP blocks
/16255.255.0.065,534Enterprise LANs
/24255.255.255.0254Typical office subnet
/25255.255.255.128126Split /24 for two zones
/26255.255.255.19262Small departments
/27255.255.255.22430Small workgroups
/28255.255.255.24014Server clusters
/30255.255.255.2522Point-to-point links

Core Subnet Calculation Formulas

networkAddress = (ipNum & maskNum) >>> 0 | broadcastAddress = (networkAddress | wildcardNum) >>> 0 | totalHosts = broadcastNum - networkNum - 1

Where:

  • ipNum= IP address converted to a 32-bit unsigned integer: ((o0 << 24) | (o1 << 16) | (o2 << 8) | o3) >>> 0
  • maskNum= Subnet mask as a 32-bit unsigned integer, derived from CIDR prefix: (~0 << (32 - cidr)) >>> 0
  • wildcardNum= Bitwise complement of the mask: (~maskNum) >>> 0
  • networkAddress= Bitwise AND of ipNum and maskNum — the first address in the subnet
  • broadcastAddress= Bitwise OR of networkAddress and wildcardNum — the last address in the subnet
  • totalHosts= Usable host count: broadcastNum minus networkNum minus 1 (excludes network and broadcast addresses)

IP Address Classes and Private Ranges

The original IPv4 design divided the address space into classes based on the value of the first octet. Although CIDR has largely replaced classful routing in modern networks, IP classes remain relevant for understanding address types, firewall rules, and router behavior.

Class A addresses have a first octet between 1 and 126. The default mask is /8, allowing up to 16,777,214 hosts per network. Large organizations and early internet pioneers received Class A allocations.

Class B addresses range from 128.0.0.0 to 191.255.255.255. The default mask is /16, supporting up to 65,534 hosts. Universities and mid-sized companies commonly used Class B space.

Class C addresses span 192.0.0.0 to 223.255.255.255 with a default /24 mask and 254 usable hosts. This is by far the most common range for small networks today.

Class D (224.0.0.0–239.255.255.255) is reserved for multicast group addressing, while Class E (240.0.0.0–255.255.255.255) is reserved for experimental use.

Within each class, certain ranges are designated as private addresses that are not routed on the public internet. RFC 1918 defines three private ranges:

  • 10.0.0.0/8 — Class A private range (10.x.x.x)
  • 172.16.0.0/12 — Class B private range (172.16.x.x through 172.31.x.x)
  • 192.168.0.0/16 — Class C private range (192.168.x.x)

Devices using private addresses access the internet through Network Address Translation (NAT), which maps private addresses to one or more public IPs. The IP address calculator identifies whether your input address falls within these private ranges and labels it accordingly, helping you quickly determine whether a host is publicly reachable or behind NAT.

Network, Broadcast, and Host Addresses

Every subnet contains three special categories of addresses: the network address, the broadcast address, and the range of usable host addresses between them.

The network address is the first address in the subnet. It has all host bits set to zero and is used to identify the subnet itself in routing tables. You cannot assign the network address to a device; it belongs to the subnet as a whole. For example, in the subnet 192.168.1.0/24, the network address is 192.168.1.0.

The broadcast address is the last address in the subnet, with all host bits set to one. Packets sent to the broadcast address are delivered to every host in the subnet. Routers do not forward broadcast traffic between subnets, which is one reason subnetting reduces network congestion. In the 192.168.1.0/24 example, the broadcast address is 192.168.1.255.

The usable host range is everything between the network address and the broadcast address. For a /24 subnet, that gives addresses 192.168.1.1 through 192.168.1.254 — a total of 254 hosts. The general formula is totalHosts = 2^(32 - cidr) - 2, which matches the calculator's computation: broadcastNum - networkNum - 1.

The wildcard mask is the bitwise inverse of the subnet mask. It is used in access control lists (ACLs) on Cisco routers and firewalls to specify which bits of an address must match a rule and which bits are "don't care." A wildcard mask of 0.0.0.255 paired with network 192.168.1.0 means "match any address where the first three octets are 192.168.1."

The calculator also displays the binary representation of both the IP address and the subnet mask. Reading the binary form makes the bitwise AND operation that produces the network address visually obvious and is essential for passing networking certification exams like CompTIA Network+ or Cisco CCNA.

How to Use This IP Address Calculator

This subnet calculator is designed for quick, accurate network planning without manual binary arithmetic. Follow these steps to get complete subnet information for any IPv4 address:

  1. Enter the IP address in dotted-decimal notation (e.g., 10.0.5.200). The calculator validates that each octet is between 0 and 255 and shows an error if the address is malformed.
  2. Choose your input method. Toggle "Use CIDR notation" to enter the prefix length using the slider (0–32), or uncheck the box to type a subnet mask in dotted-decimal format. Both inputs yield the same result — the calculator converts between them automatically using the formula maskToCidr, which counts the set bits in the mask.
  3. Use a quick-select subnet button for common prefix lengths (/8, /16, /24, /25, /26, /27, /28, /30) to instantly switch to a standard subnet size.
  4. Read the results. The right panel displays the network address, broadcast address, first host, last host, wildcard mask, usable host count, IP class, binary representations, and whether the address is private or public.
  5. Copy any value to your clipboard with the Copy button next to each result field — convenient when populating firewall rules, router configurations, or documentation.

For network engineers dealing with variable-length subnet masking (VLSM), you can run the calculator multiple times with different prefix lengths to plan how to subdivide a larger block into appropriately sized subnets for each department or server group.

Worked Examples

Standard Office Network: 192.168.1.100/24

Problem:

A device has the IP address 192.168.1.100 and a /24 subnet mask. Find the network address, broadcast address, usable host range, and total host count.

Solution Steps:

  1. 1Convert the CIDR prefix /24 to a subnet mask: 24 ones followed by 8 zeros in binary = 255.255.255.0
  2. 2Compute ipNum = (192 << 24) | (168 << 16) | (1 << 8) | 100 = 3,232,235,876
  3. 3Compute maskNum = (~0 << (32 - 24)) >>> 0 = 4,294,967,040 (binary: 11111111.11111111.11111111.00000000)
  4. 4Network address = (ipNum & maskNum) >>> 0 = 3,232,235,776 → 192.168.1.0
  5. 5Wildcard mask = (~maskNum) >>> 0 = 255 → 0.0.0.255
  6. 6Broadcast address = (networkNum | wildcardNum) >>> 0 = 3,232,236,031 → 192.168.1.255
  7. 7First host = networkNum + 1 → 192.168.1.1 | Last host = broadcastNum - 1 → 192.168.1.254
  8. 8Total usable hosts = 192.168.1.255 − 192.168.1.0 − 1 = 254

Result:

Network: 192.168.1.0/24 | Broadcast: 192.168.1.255 | Hosts: 192.168.1.1–192.168.1.254 | Usable hosts: 254 | Type: Private (Class C)

Point-to-Point Link: 10.0.0.1/30

Problem:

Two routers are connected via a /30 subnet starting at 10.0.0.0. What are the two usable host addresses and how many hosts does this subnet support?

Solution Steps:

  1. 1Convert /30 to subnet mask: 30 ones, 2 zeros → 255.255.255.252
  2. 2ipNum for 10.0.0.1 = (10 << 24) | 1 = 167,772,161
  3. 3maskNum = (~0 << (32 - 30)) >>> 0 = 4,294,967,292
  4. 4Network address = (167,772,161 & 4,294,967,292) >>> 0 = 167,772,160 → 10.0.0.0
  5. 5Wildcard mask = (~4,294,967,292) >>> 0 = 3 → 0.0.0.3
  6. 6Broadcast = (167,772,160 | 3) >>> 0 = 167,772,163 → 10.0.0.3
  7. 7Total usable hosts = 10.0.0.3 − 10.0.0.0 − 1 = 2

Result:

Network: 10.0.0.0/30 | Broadcast: 10.0.0.3 | First host: 10.0.0.1 | Last host: 10.0.0.2 | Usable hosts: 2 | Type: Private (Class A)

Enterprise VLAN Split: 172.16.4.50/26

Problem:

A network engineer is subnetting the 172.16.4.0/24 block into /26 subnets for four departments. Device 172.16.4.50 is in one of those subnets. Determine its full subnet details.

Solution Steps:

  1. 1Convert /26 to subnet mask: 26 ones, 6 zeros → 255.255.255.192
  2. 2ipNum for 172.16.4.50 = (172 << 24) | (16 << 16) | (4 << 8) | 50 = 2,886,861,874
  3. 3maskNum = (~0 << (32 - 26)) >>> 0 = 4,294,967,232 (binary last octet: 11000000)
  4. 4Network address = (2,886,861,874 & 4,294,967,232) >>> 0 → 172.16.4.0
  5. 5Wildcard mask = (~maskNum) >>> 0 → 0.0.0.63
  6. 6Broadcast = (networkNum | 63) >>> 0 → 172.16.4.63
  7. 7First host = 172.16.4.1 | Last host = 172.16.4.62
  8. 8Total usable hosts = 172.16.4.63 − 172.16.4.0 − 1 = 62

Result:

Network: 172.16.4.0/26 | Broadcast: 172.16.4.63 | Hosts: 172.16.4.1–172.16.4.62 | Usable hosts: 62 | Type: Private (Class B)

Public Class B: 130.211.10.5/16

Problem:

A server has a public IP of 130.211.10.5 with a /16 prefix. Identify its class, network address, and usable host range.

Solution Steps:

  1. 1First octet is 130, which falls in range 128–191 → Class B
  2. 2Convert /16 to subnet mask: 255.255.0.0
  3. 3maskNum = (~0 << (32 - 16)) >>> 0 = 4,294,901,760
  4. 4ipNum for 130.211.10.5 = (130 << 24) | (211 << 16) | (10 << 8) | 5
  5. 5Network address = (ipNum & maskNum) >>> 0 → 130.211.0.0
  6. 6Wildcard = 0.0.255.255 | Broadcast = 130.211.255.255
  7. 7Total usable hosts = 130.211.255.255 − 130.211.0.0 − 1 = 65,534

Result:

Network: 130.211.0.0/16 | Broadcast: 130.211.255.255 | Usable hosts: 65,534 | IP class: B | Type: Public

Tips & Best Practices

  • Use /30 subnets for point-to-point router links — they provide exactly 2 usable hosts and waste the fewest addresses.
  • Memorize the pattern for common CIDR block sizes: /24 = 254 hosts, /25 = 126, /26 = 62, /27 = 30, /28 = 14, /30 = 2.
  • Always confirm whether an IP is private (RFC 1918) before exposing it in public DNS — private addresses are not reachable from the internet.
  • The wildcard mask is simply 255.255.255.255 minus the subnet mask; use it directly in Cisco ACLs and OSPF network statements.
  • When planning a network, choose a CIDR block at least one size larger than your current device count to leave room for growth.
  • Binary representation helps verify your work: the network bits of the IP and the mask will always align perfectly at the same bit position.
  • A /32 mask (255.255.255.255) identifies a single host and is commonly used in host routes and loopback address entries.
  • For cloud VPC subnetting, cloud providers often reserve 4–5 addresses per subnet (not just 2), so factor that in when sizing your blocks.

Frequently Asked Questions

A subnet mask uses 1s to mark the network portion of an address and 0s to mark the host portion. A wildcard mask is the bitwise inverse — 0s where the subnet mask has 1s and 1s where it has 0s. Subnet masks are used to calculate network and broadcast addresses, while wildcard masks appear in Cisco ACLs and OSPF configurations to define which bits of an address must match a rule. The IP address calculator computes both automatically.
Every subnet reserves its first address as the network identifier and its last address as the broadcast address. Neither can be assigned to a host. In a /24 subnet with 256 total addresses, 254 are usable. For very small subnets like /30, only 2 of the 4 total addresses are usable; /31 and /32 subnets have special meanings and no traditional host-broadcast split applies, which is why this calculator reports 0 usable hosts for CIDR values of 31 or 32.
Private IP addresses (defined in RFC 1918) are the ranges 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Internet routers drop packets sourced from or destined to these ranges, so they can only be used within a local network. Devices using private addresses reach the public internet through NAT (Network Address Translation) on a router or firewall. Knowing whether an address is private or public is important for firewall rule writing, VPN configuration, and troubleshooting connectivity issues.
To convert a CIDR prefix N to a subnet mask, the calculator sets the leftmost N bits to 1 using the expression <code>(~0 &lt;&lt; (32 - N)) &gt;&gt;&gt; 0</code> and converts the resulting 32-bit number to dotted-decimal. To go the other direction (mask to CIDR), it counts the number of 1-bits in the mask's binary representation. This is mathematically equivalent to the standard definition and handles all valid prefix lengths from /0 (0.0.0.0) to /32 (255.255.255.255).
A /30 subnet provides exactly 2 usable host addresses from a pool of 4 total addresses. It is the smallest subnet that still has a distinct network and broadcast address. /30 subnets are commonly used for point-to-point links between routers, where you only need two IP addresses — one for each end of the link. Using a /30 instead of a /24 avoids wasting 252 addresses on a connection that will never have more than two devices.
This calculator is designed for IPv4 addresses only, which use 32-bit addresses in dotted-decimal notation. IPv6 uses 128-bit addresses in hexadecimal colon-separated notation and has a fundamentally different subnetting structure. For IPv6 planning, you would need a dedicated IPv6 subnet calculator. IPv4 subnetting remains essential for most on-premises networks, IoT deployments, and legacy infrastructure.
Variable-Length Subnet Masking (VLSM) allows network engineers to use different subnet mask lengths within the same network, allocating exactly the right number of addresses to each segment. For example, a data center might use a /28 for a 10-server cluster, a /24 for the office LAN, and a /30 for each router-to-router link — all carved from a single /20 block. This IP address calculator supports VLSM planning by letting you quickly evaluate different prefix lengths and determine the exact host counts and address ranges for each proposed subnet.

Sources & References

Last updated: 2026-06-05

💡

Help us improve!

How would you rate the IP Address Calculator?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.