Subnet Calculator — IPv4 Mask & Host Range
Calculate network address, broadcast address, subnet mask, wildcard mask, usable host range, and total hosts from any IP address and CIDR notation.
Subnet Calculator — IPv4 Mask & Host Range
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: Network Address = IP AND Subnet Mask; Broadcast = Network OR Wildcard Mask
Worked example — Network: 192.168.1.0 | Range: .1-.254 | Broadcast: .255 | 254 usable hosts
Formula
Network Address = IP AND Subnet Mask; Broadcast = Network OR Wildcard Mask
The network address is found by performing a bitwise AND between the IP address and subnet mask. The broadcast address is found by performing a bitwise OR between the network address and the wildcard mask (inverse of subnet mask). Usable hosts = 2^(32-CIDR) - 2 (subtracting network and broadcast addresses). The CIDR prefix length indicates how many leading bits form the network portion.
Worked Examples
Example 1: Standard Home Network (/24)
Problem:Calculate subnet details for IP 192.168.1.100 with CIDR /24.
Solution:IP: 192.168.1.100 CIDR: /24 → Subnet Mask: 255.255.255.0 Binary IP: 11000000.10101000.00000001.01100100 Binary Mask: 11111111.11111111.11111111.00000000 Network (AND): 11000000.10101000.00000001.00000000 = 192.168.1.0 Broadcast (OR wildcard): 192.168.1.255 Wildcard: 0.0.0.255 Usable range: 192.168.1.1 - 192.168.1.254 Total hosts: 256, Usable: 254
Result:Network: 192.168.1.0 | Range: .1-.254 | Broadcast: .255 | 254 usable hosts
Example 2: Enterprise Subnet (/26)
Problem:Subnet 10.0.5.67/26 — find the network, broadcast, and usable range.
Solution:IP: 10.0.5.67 CIDR: /26 → Subnet Mask: 255.255.255.192 Wildcard: 0.0.0.63 67 in binary: 01000011 Mask last octet: 11000000 AND: 01000000 = 64 Network: 10.0.5.64 Broadcast: 10.0.5.64 + 63 = 10.0.5.127 First host: 10.0.5.65 Last host: 10.0.5.126 Usable hosts: 62
Result:Network: 10.0.5.64 | Range: .65-.126 | Broadcast: .127 | 62 usable hosts
Frequently Asked Questions
What is subnetting and why is it important?
Subnetting is the process of dividing a larger network into smaller, more manageable sub-networks (subnets). It serves several critical purposes in networking: Network segmentation — separating departments, floors, or functions into distinct networks improves organization and management. Security — subnets create boundaries that can be controlled with firewalls and access control lists (ACLs), limiting broadcast domains and reducing the attack surface. Performance — smaller broadcast domains mean less broadcast traffic, reducing network congestion and improving performance. Efficient IP usage — subnetting allows organizations to allocate IP addresses more efficiently rather than wasting entire Class A, B, or C blocks. For example, a /24 network (254 usable hosts) can be split into two /25 networks (126 hosts each) or four /26 networks (62 hosts each), matching actual department sizes.
How does CIDR notation work?
CIDR (Classless Inter-Domain Routing) notation represents an IP address and its associated subnet mask in a compact format: IP/prefix-length. The prefix length indicates how many bits of the 32-bit IP address represent the network portion. For example, 192.168.1.0/24 means the first 24 bits are the network part and the remaining 8 bits are for host addresses. Common CIDR notations: /8 = 255.0.0.0 (16,777,214 hosts), /16 = 255.255.0.0 (65,534 hosts), /24 = 255.255.255.0 (254 hosts), /25 = 255.255.255.128 (126 hosts), /26 = 255.255.255.192 (62 hosts), /27 = 255.255.255.224 (30 hosts), /28 = 255.255.255.240 (14 hosts), /30 = 255.255.255.252 (2 hosts — used for point-to-point links), /32 = 255.255.255.255 (1 host — a single IP). CIDR replaced the old classful addressing system.
What are the network address and broadcast address?
The network address is the first address in a subnet — it identifies the subnet itself and cannot be assigned to a host. It's calculated by performing a bitwise AND between the IP address and the subnet mask. For 192.168.1.100/24, the network address is 192.168.1.0. The broadcast address is the last address in a subnet — packets sent to this address are received by all hosts in the subnet. It's calculated by setting all host bits to 1. For 192.168.1.0/24, the broadcast address is 192.168.1.255. Between these two special addresses are the usable host addresses. For a /24 network: network = .0, first usable = .1, last usable = .254, broadcast = .255, giving 254 usable addresses. For a /30 network (commonly used for point-to-point links): only 2 usable addresses exist between the network and broadcast addresses.
What is the difference between public and private IP addresses?
Private IP addresses are reserved for internal network use and are not routable on the public internet. Three ranges are defined in RFC 1918: 10.0.0.0/8 (10.0.0.0 to 10.255.255.255 — 16.7 million addresses), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255 — 1 million addresses), and 192.168.0.0/16 (192.168.0.0 to 192.168.255.255 — 65,536 addresses). Public IP addresses are globally unique and routable on the internet. They're assigned by ISPs and regional internet registries (ARIN, RIPE, APNIC). Network Address Translation (NAT) allows multiple devices with private IPs to share a single public IP for internet access. Most home and office networks use private addressing (commonly 192.168.1.0/24 or 10.0.0.0/24) behind a router performing NAT. Understanding this distinction is crucial for network design, security, and troubleshooting connectivity issues.
How do I determine the right subnet size for my network?
To choose the right subnet size, count the number of devices that need IP addresses and select a CIDR prefix that provides enough usable addresses with room for growth. Include all devices: computers, phones, printers, IoT devices, network equipment, and servers. Plan for 50-100% growth beyond current needs. For 10 devices: /28 gives 14 usable addresses. For 25 devices: /27 gives 30 usable addresses. For 50 devices: /26 gives 62 usable addresses. For 100 devices: /25 gives 126 usable addresses. For 200 devices: /24 gives 254 usable addresses. Remember that every subnet loses 2 addresses (network and broadcast), and you may need addresses for the default gateway, DHCP server, DNS server, and other infrastructure. A common mistake is choosing a subnet that exactly matches current needs — always leave headroom. For VLANs in enterprise networks, /24 is the most common choice for general-purpose subnets.
What is a wildcard mask and where is it used?
A wildcard mask is the bitwise inverse of the subnet mask, and its bits mean the opposite thing: a zero says the corresponding address bit must match exactly, a one says ignore it. A /26 has mask 255.255.255.192, so its wildcard is 0.0.0.63. Cisco access control lists and OSPF network statements are written with wildcards rather than masks, which is also why they can express non-contiguous patterns that no subnet mask can, such as 0.0.0.254 matching only the odd-numbered or only the even-numbered hosts in a range.
Can one address block be split into subnets of different sizes?
Variable-length subnet masking lets one parent block be carved into pieces of different sizes, each matched to the segment that needs it, instead of splitting it into equal chunks sized for the largest one. From 192.168.10.0/24 you can take 192.168.10.0/25 for a 100-user LAN, 192.168.10.128/26 for a 50-user LAN, 192.168.10.192/27 for 20 servers, and a run of /30 or /31 links from 192.168.10.224. It requires routing protocols that advertise a prefix with every route, such as OSPF or RIPv2.
Why does Subnet Calculator — IPv4 Mask & Host Range report zero usable hosts for a /31 but one for a /32?
The usable count subtracts the network identifier and the broadcast address from the block, which is why a /31 reports zero: it holds two addresses and classic arithmetic spends both. A /32 is different in kind rather than in degree. It has no host field at all, so there is nothing to subtract and the tool reports the single address, which describes a host route or a loopback rather than a segment. RFC 3021 changes practice without changing that arithmetic: on a point-to-point interface a /31 has no meaningful broadcast, so both addresses are assignable and the number to read on this page is the total of two, not the usable count of zero.
How do you work out which subnet an address belongs to without binary?
Use the block size, sometimes called the magic number: subtract the interesting mask octet from 256. For a /26 the mask ends in 192, so the block size is 64 and subnet boundaries fall at .0, .64, .128 and .192. An address such as 10.0.5.67 sits between 64 and 127, so its network is 10.0.5.64, its broadcast is 10.0.5.127 and its usable range is .65 to .126. The same trick works on any octet: a /20 gives 256 minus 240, or blocks of 16, in the third octet.
Is the Class A, B, or C label still meaningful today?
Only as a historical readout. Classful addressing inferred the mask from the first octet, with 1 to 126 treated as Class A, 128 to 191 as Class B and 192 to 223 as Class C, and CIDR replaced that inference in 1993 with an explicit prefix length. Some ranges defined then remain reserved: 127.0.0.0/8 for loopback, 224.0.0.0/4 for multicast and 240.0.0.0/4 as reserved space. Modern equipment ignores class entirely and honours whatever prefix length is configured.
References
Background & Theory
History
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer · Editorial policy
Related Calculators
🧮Bandwidth Time Transfer Calculator
Calculate bandwidth time transfer with inputs, formulas, and instant results.
🧮Download Time Calculator
Calculate download time with inputs, formulas, and instant results.
🧮Throughput Efficiency Calculator
Calculate throughput efficiency with inputs, formulas, and instant results.
🧮Base64 Encode & Decode Calculator
Calculate base64encode decode with inputs, formulas, and instant results.
🧮Hash Checksum Calculator
Calculate hash checksum with inputs, formulas, and instant results.
🧮Urlpercent Encoding Calculator
Calculate urlpercent encoding with inputs, formulas, and instant results.
🧮Cron Expression Builder Calculator
Calculate cron expression builder with inputs, formulas, and instant results.
🧮MTBF/MTTR Calculator
Calculate mtbf mttrcalculator with inputs, formulas, and instant results.