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
192.168.1.100255.255.255.0192.168.1.0192.168.1.255192.168.1.1192.168.1.2540.0.0.255IP 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 |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Large ISP blocks |
| /16 | 255.255.0.0 | 65,534 | Enterprise LANs |
| /24 | 255.255.255.0 | 254 | Typical office subnet |
| /25 | 255.255.255.128 | 126 | Split /24 for two zones |
| /26 | 255.255.255.192 | 62 | Small departments |
| /27 | 255.255.255.224 | 30 | Small workgroups |
| /28 | 255.255.255.240 | 14 | Server clusters |
| /30 | 255.255.255.252 | 2 | Point-to-point links |
Core Subnet Calculation Formulas
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:
- 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.
- 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. - 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.
- 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.
- 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:
- 1Convert the CIDR prefix /24 to a subnet mask: 24 ones followed by 8 zeros in binary = 255.255.255.0
- 2Compute ipNum = (192 << 24) | (168 << 16) | (1 << 8) | 100 = 3,232,235,876
- 3Compute maskNum = (~0 << (32 - 24)) >>> 0 = 4,294,967,040 (binary: 11111111.11111111.11111111.00000000)
- 4Network address = (ipNum & maskNum) >>> 0 = 3,232,235,776 → 192.168.1.0
- 5Wildcard mask = (~maskNum) >>> 0 = 255 → 0.0.0.255
- 6Broadcast address = (networkNum | wildcardNum) >>> 0 = 3,232,236,031 → 192.168.1.255
- 7First host = networkNum + 1 → 192.168.1.1 | Last host = broadcastNum - 1 → 192.168.1.254
- 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:
- 1Convert /30 to subnet mask: 30 ones, 2 zeros → 255.255.255.252
- 2ipNum for 10.0.0.1 = (10 << 24) | 1 = 167,772,161
- 3maskNum = (~0 << (32 - 30)) >>> 0 = 4,294,967,292
- 4Network address = (167,772,161 & 4,294,967,292) >>> 0 = 167,772,160 → 10.0.0.0
- 5Wildcard mask = (~4,294,967,292) >>> 0 = 3 → 0.0.0.3
- 6Broadcast = (167,772,160 | 3) >>> 0 = 167,772,163 → 10.0.0.3
- 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:
- 1Convert /26 to subnet mask: 26 ones, 6 zeros → 255.255.255.192
- 2ipNum for 172.16.4.50 = (172 << 24) | (16 << 16) | (4 << 8) | 50 = 2,886,861,874
- 3maskNum = (~0 << (32 - 26)) >>> 0 = 4,294,967,232 (binary last octet: 11000000)
- 4Network address = (2,886,861,874 & 4,294,967,232) >>> 0 → 172.16.4.0
- 5Wildcard mask = (~maskNum) >>> 0 → 0.0.0.63
- 6Broadcast = (networkNum | 63) >>> 0 → 172.16.4.63
- 7First host = 172.16.4.1 | Last host = 172.16.4.62
- 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:
- 1First octet is 130, which falls in range 128–191 → Class B
- 2Convert /16 to subnet mask: 255.255.0.0
- 3maskNum = (~0 << (32 - 16)) >>> 0 = 4,294,901,760
- 4ipNum for 130.211.10.5 = (130 << 24) | (211 << 16) | (10 << 8) | 5
- 5Network address = (ipNum & maskNum) >>> 0 → 130.211.0.0
- 6Wildcard = 0.0.255.255 | Broadcast = 130.211.255.255
- 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
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.
Formula Source: Standard Mathematical References
by Various