SC
Subnet Calculator
Calculate subnet details from any IP address and CIDR prefix — network, broadcast, range, hosts.
More Network & IT Tools
Network Address
Broadcast Address
Subnet Mask
Wildcard Mask
Usable Host Range
Total Hosts
Usable Hosts
IP Class
How to Use Subnet Calculator
Enter an IPv4 address and a CIDR prefix (0-32) to instantly see the network address, broadcast address, subnet mask, wildcard mask, usable host range, total and usable hosts, and IP class. All computed in your browser with pure JavaScript — no server round-trip.
About Subnet Calculator
Subnetting — dividing a larger IP address block into smaller, logically separated sub-networks — is a foundational concept in IP networking that every system administrator, network engineer, and DevOps practitioner works with regularly. At its simplest, a subnet calculator answers: given this IP address and this prefix length (e.g., 192.168.1.37/24), what is the network this address belongs to (192.168.1.0), what is the broadcast address (192.168.1.255), what subnet mask defines this boundary (255.255.255.0), how many devices can fit in this subnet (254 usable hosts), and what is the valid range of IP addresses that can be assigned to devices (192.168.1.1 through 192.168.1.254)?\n\nCIDR (Classless Inter-Domain Routing) notation, written as an IP address followed by a slash and a number from 0 to 32, is the modern way to specify subnet boundaries — it replaced the older "classful" system (Class A, B, C) in the 1990s but the class labels survive as convenient shorthand. The number after the slash is the prefix length: the number of bits in the IP address that are fixed (the network portion). A /24 means the first 24 bits are the network identifier and the remaining 8 bits identify individual hosts — giving 2^8 = 256 addresses, minus 2 reserved (network address and broadcast), leaving 254 usable.\n\nThe calculation is straightforward binary arithmetic — there is no need for a server round-trip, and this tool runs entirely in your browser using JavaScript integer operations: bitwise AND for the network address, bitwise OR for the broadcast address, bitwise NOT for the wildcard mask, and power-of-two arithmetic for host counts. The result updates instantly as you change the IP or prefix values.\n\nA practical use case: you have been allocated the block 10.20.30.0/24 for a new office network. You need to split it into 4 sub-department networks. Dividing a /24 into 4 equal subnets means borrowing 2 bits (2^2 = 4), making each subnet a /26. Enter 10.20.30.0/26 in the calculator and you will see: 62 usable hosts per subnet, mask 255.255.255.192, broadcast 10.20.30.63. The four subnets would be 10.20.30.0/26, 10.20.30.64/26, 10.20.30.128/26, and 10.20.30.192/26 — each serving up to 62 devices.\n\nThe edge cases are instructive. /32 (single host, 255.255.255.255) has exactly one address and is used for loopback interfaces or specific routing entries. /31 (point-to-point links, RFC 3021) has two addresses, neither of which is reserved for network or broadcast — both are usable for the two endpoints of a serial link. /0 represents the entire internet (0.0.0.0/0, the default route in routing tables). /24 is the most common subnet for small networks because it divides cleanly at the byte boundary.\n\nA word on IP classes: this tool shows the class for reference because many people still speak in classful terms, but modern networking uses CIDR, not classes. The class is determined by the first octet of the IP address alone and has no bearing on the actual subnet mask in CIDR. A 10.x.x.x address is Class A by convention but can be subnetted as tightly as /32 — the class label is informational, not prescriptive.
Details & Tips
All computation uses bitwise integer arithmetic: (1) the IP and mask are converted to unsigned 32-bit integers by splitting at each octet, (2) network = ip & mask (bitwise AND retains only network prefix bits), (3) broadcast = network | ~mask (bitwise OR of network with inverted mask fills host bits with 1s), (4) wildcard = ~mask (inverted mask, used in some routing rules), (5) totalHosts = 2^(32 - prefix), (6) usableHosts = totalHosts - 2 (except /31 and /32 where the broadcast and network address are usable as host addresses).\n\nJavaScript\u0027s bitwise operators work on 32-bit signed integers, so we use >>> 0 (unsigned right shift by zero) to convert results back to unsigned 32-bit values and avoid negative numbers when the highest bit is set (broadcast addresses in large subnets). The ipToInt parser validates each octet is 0-255 with no leading junk. The intToIp formatter reconstructs the dotted-quad by extracting each octet via right-shift and AND with 0xFF.
Frequently Asked Questions
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes a subnet as IP/prefix, e.g., 192.168.1.0/24. The number after the slash is the number of fixed bits in the network prefix. /24 means the first 24 bits identify the network and the remaining 8 bits identify individual hosts.
What is the difference between total hosts and usable hosts?
Total hosts is every address in the subnet (2^(32-prefix)). Usable hosts is total minus 2, because the first address is reserved as the network address (identifies the subnet itself) and the last is reserved as the broadcast address (reaches all hosts on the subnet). For /31 subnets (point-to-point links) both addresses are usable.
Why does a /24 subnet have 254 usable hosts, not 256?
Two addresses in every subnet (except /31 and /32) are reserved: the network address (e.g., 192.168.1.0) identifies the subnet itself and cannot be assigned to a device. The broadcast address (e.g., 192.168.1.255) sends a packet to all devices on the subnet and cannot be assigned to a single device. That leaves 254 usable addresses for actual hosts.
What is a subnet mask?
A subnet mask is the traditional way to write the network/host boundary — 255.255.255.0 for a /24 prefix. Any IP bit aligned with a 255 in the mask belongs to the network portion; any bit aligned with a 0 belongs to the host portion. The mask is the binary complement of the wildcard mask.
What does "IP Class" mean in the results?
It shows the classful network class (A, B, C, D, or E) based on the first octet alone — a historical classification from before CIDR. A: 1-126 (large networks), B: 128-191 (medium), C: 192-223 (small), D: 224-239 (multicast), E: 240-255 (reserved/experimental). Modern networking uses CIDR, not classes, but the labels survive as convenience shorthand.
Can I calculate subnets for IPv6?
No — this tool is for IPv4 only. IPv6 uses 128-bit addresses and a different subnetting model. The arithmetic is conceptually similar but requires big-integer operations that are beyond the scope of this tool.
What happens with a /32 prefix?
A /32 is a single host address with a subnet mask of 255.255.255.255. There is one address, no distinction between network and broadcast, and it is typically used for loopback interfaces, VPN endpoints, or specific /32 host routes in routing tables.
Why does the calculator show my class differently than I expected?
IP class is determined solely by the first octet, not by the subnet mask or CIDR prefix. 10.0.0.0/8 is Class A by first octet (10 is in the 1-126 range). 10.0.0.0/24 is still Class A by the same criterion — the fact that it is subnetted to /24 does not change its class. This is historical terminology and does not affect the actual subnet calculation.
Is my IP address sent to a server when I use this tool?
No. All subnet calculations run in your browser using JavaScript — nothing is transmitted, logged, or stored. You can enter private IPs, public IPs, or made-up IPs and the tool works identically offline.
How can I split a /24 network into smaller subnets?
To create smaller subnets, increase the prefix length. For 2 equal subnets, use /25 (128 addresses each, 126 usable). For 4 equal subnets, use /26 (64 each, 62 usable). For 8 equal subnets, use /27 (32 each, 30 usable). Enter the new network address with the longer prefix (e.g., 192.168.1.64/26) in the calculator to see the details of each sub-subnet.
Part of These Collections
Also Available As
subnet calculator, cidr calculator, ip subnet calculator, network calculator, subnet mask calculator, ipv4 subnet, calculate subnet, vlsm calculator
Found a Problem?
Let us know if something with Subnet Calculator isn't working as expected.
Something went wrong. Please try again.
Thanks — we'll take a look.