Subnet calculator
Subnet calculator — CIDR / IP range / VLSM
Enter any IPv4 CIDR (e.g. 192.168.1.0/24) and instantly see the network address, broadcast, usable host range, total hosts, subnet mask, wildcard mask, IP class, and binary breakdown. Runs entirely in your browser, no login, no tracking.
What this subnet calculator does
CIDR (Classless Inter-Domain Routing) notation lets you describe any IPv4 network in one short string. This tool parses that string, derives the subnet mask, and gives you every other number you usually need: the network address (the address with all host bits set to zero), the broadcast address (all host bits set to one), the first and last usable host addresses, the total and usable host counts, the wildcard mask (the bitwise inverse of the subnet mask), the IP class, and the binary representation of each octet. Everything happens in your browser — no server call, no data leaves your machine.
CIDR notation is an IP address, a slash, and a number from 0 to 32. Example: 192.168.1.0/24
How subnet calculation works
An IPv4 address is 32 bits. CIDR notation splits those 32 bits into a network portion and a host portion: the number after the slash is the length of the network portion. For a /24, the first 24 bits identify the network and the remaining 8 bits identify a specific host. The network address has all host bits set to 0; the broadcast address has all host bits set to 1. Usable hosts are everything in between. The subnet mask is 32 ones followed by (32 minus prefix) zeros in binary, or a dotted-decimal like 255.255.255.0 for /24. The wildcard mask is the bitwise inverse of the subnet mask and is used in Cisco ACLs and some routing protocols.
IPv4 address classes
The old classful system split IPv4 into five classes by the leading bits of the first octet: Class A (1.0.0.0–126.255.255.255, /8 default), Class B (128.0.0.0–191.255.255.255, /16), Class C (192.0.0.0–223.255.255.255, /24), Class D (224.0.0.0–239.255.255.255, reserved for multicast), and Class E (240.0.0.0–255.255.255.255, reserved for future use). 127.0.0.0/8 is loopback. Classful addressing is historical — modern networks use CIDR — but the classes still show up in exams and some legacy routing configurations.
Frequently asked questions
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes a network as an IP address followed by a slash and a number from 0 to 32. The number is the prefix length — the count of leading 1-bits in the subnet mask. 192.168.1.0/24 means the first 24 bits identify the network and the last 8 bits identify hosts. /24 is the most common on private networks, equivalent to the old class-C 255.255.255.0 mask.
How do I calculate the number of hosts in a subnet?
Take 2 to the power of (32 minus the prefix length) and subtract 2. The two you subtract are the network address (all host bits zero) and the broadcast address (all host bits one), neither of which can be assigned to a device. For /24, that is 2^8 - 2 = 254 usable hosts. /31 and /32 are special: /31 has 2 usable hosts (RFC 3021) and /32 is a single address.
What is the difference between a subnet mask and a wildcard mask?
A subnet mask marks the network portion of an address with 1s and the host portion with 0s, in the same bit positions as the address. A wildcard mask is the bitwise inverse: 0s in the network portion, 1s in the host portion. Subnet masks are used for routing; wildcard masks are used in Cisco ACLs and some routing protocols. The math is identical, just inverted.
What is VLSM?
VLSM (Variable Length Subnet Masking) is the practice of splitting a network into subnets of different sizes based on how many hosts each subnet actually needs. A point-to-point link only needs 2 addresses (/31), a small office might need 50 (/26), and a data center might need 1000 (/22). VLSM avoids wasting address space — the old classful system required every subnet to be the same size.
How do I know which IP class I have?
The class is determined by the leading bits of the first octet: Class A starts with 0 (1–126), Class B starts with 10 (128–191), Class C starts with 110 (192–223), Class D starts with 1110 (224–239, used for multicast), and Class E starts with 1111 (240–255, reserved). 127.x.x.x is loopback and not assigned to any class.