IP Subnet Calculator (CIDR)
Enter an IPv4 address and a CIDR prefix (0–32). The calculator returns the network address, broadcast address, usable host range, subnet and wildcard masks, total addresses, host count, address class, and the IP and mask in binary.
Subnet
192.168.1.0/24
- Subnet (CIDR)
- 192.168.1.0/24
- Network address
- 192.168.1.0
- Broadcast address
- 192.168.1.255
- Usable host range
- 192.168.1.1 – 192.168.1.254
- Subnet mask
- 255.255.255.0
- Wildcard mask
- 0.0.0.255
- Total addresses
- 256
- Usable hosts
- 254
- Address class
- Class C
- Address type
- Private (RFC 1918)
- IP in binary
- 11000000.10101000.00000001.00001010
- Mask in binary
- 11111111.11111111.11111111.00000000
The CIDR prefix splits the 32-bit address into a network part (the first /N bits) and a host part (the remaining 32−N bits). The network address ANDs the IP with the mask; the broadcast address ORs the network with the inverted mask; usable hosts are everything in between.
How to use this calculator
Type the IPv4 address in dotted-decimal form (four octets separated by dots, each 0–255). Set the CIDR prefix length: the number of bits that identify the network. /24 is the everyday LAN size (256 addresses, 254 usable hosts). /16 is a corporate slice (65,536 addresses). /30 is the classic four-address point-to-point. /31 is the modern two-host point-to-point per RFC 3021. /32 is a single host (often used in firewall rules and routing).
How the calculation works
CIDR (RFC 4632) writes an IPv4 subnet as address/prefix, where the prefix is the number of leading bits that belong to the network. The subnet mask is the prefix bits set to 1 followed by zeros — /24 is 11111111.11111111.11111111.00000000 = 255.255.255.0. The network address is the bitwise AND of the IP and the mask; the broadcast address is the bitwise OR of the network and the inverted mask (the "wildcard"). Total addresses in the subnet is 2^(32−prefix). Usable hosts is total − 2 for prefixes /0–/30 (network and broadcast are reserved). RFC 3021 lets /31 use both addresses for point-to-point links, and /32 is a single host with no network/broadcast distinction. Address class is read from the first octet (Class A 0–127, B 128–191, C 192–223, D multicast 224–239, E reserved 240–255) — strictly legacy now, but still printed by most tools. Address type is classified per RFC 1918 (10/8, 172.16/12, 192.168/16 private), RFC 3927 (169.254/16 link-local), and RFC 5735 (127/8 loopback, 224/4 multicast, 240/4 reserved).
Worked example
Take 192.168.1.10/24. The mask /24 is 255.255.255.0 (binary 11111111.11111111.11111111.00000000), and the wildcard is the inverse 0.0.0.255. AND the IP with the mask: 192.168.1.10 & 255.255.255.0 = 192.168.1.0 — the network address. OR the network with the wildcard: 192.168.1.0 | 0.0.0.255 = 192.168.1.255 — the broadcast address. Total addresses = 2^(32−24) = 256. Usable hosts = 256 − 2 = 254, running from 192.168.1.1 to 192.168.1.254. First octet 192 is Class C; 192.168/16 is RFC 1918 private. Compare a /30: 10.0.0.5/30 has mask 255.255.255.252, network 10.0.0.4, broadcast 10.0.0.7, and just two usable hosts (10.0.0.5 and 10.0.0.6) — the standard point-to-point sliver.
Frequently asked questions
What is CIDR notation?
CIDR — Classless Inter-Domain Routing — writes an IPv4 subnet as address/prefix, where the prefix length is the number of bits that identify the network (0–32). It replaced the rigid Class A/B/C boundaries in 1993 (RFC 1519, updated by RFC 4632), letting providers carve up address space in whatever power-of-two chunk is actually needed. 10.0.0.0/8 has 8 network bits and 24 host bits; 192.168.1.0/24 has 24 network bits and 8 host bits.
Why do I subtract 2 for usable hosts?
For most prefix lengths the lowest address in the subnet is the network address (every host bit 0) and the highest is the broadcast address (every host bit 1). Neither can be assigned to a host, so usable hosts = 2^(host bits) − 2. A /24 has 256 addresses but 254 usable hosts. The exceptions are /31 (RFC 3021: both addresses are usable for point-to-point links) and /32 (a single host with no separate network or broadcast).
What is the difference between the subnet mask and the wildcard mask?
The subnet mask has the network bits set to 1 and the host bits set to 0 — for /24, 255.255.255.0. The wildcard mask is the bitwise inverse: host bits set to 1 and network bits set to 0 — for /24, 0.0.0.255. Subnet masks are what end hosts and routing tables use; wildcard masks are what Cisco access-control lists and OSPF area definitions use, because they let you describe "any address where these bits can be anything".
What are private IP ranges?
RFC 1918 reserves three private address ranges that are never routed on the public internet: 10.0.0.0/8 (16,777,216 addresses), 172.16.0.0/12 (1,048,576 addresses), and 192.168.0.0/16 (65,536 addresses). Home routers nearly always use 192.168.x.x or 10.x.x.x; medium-to-large enterprise networks reach into 172.16/12. NAT translates these into public addresses at the network edge.
Are address classes still used?
No, not for routing. Classes A, B, C, D, and E were the original IPv4 allocation scheme from RFC 791 (1981), with fixed boundaries at /8, /16, and /24. CIDR replaced classful routing in 1993. The class label is still printed by every subnet tool out of habit and because some firewall rule generators and academic textbooks reference it, but it has no operational meaning on the modern internet — your /27 inside 10.0.0.0/8 is still a /27.
What does /32 mean?
A /32 prefix has all 32 bits as network and zero host bits, so it describes exactly one address. It is the form a firewall uses when allowing a single source IP, the form BGP uses to advertise a loopback for router-ID purposes, and the form Kubernetes services use for ClusterIP rules. There is no network address, no broadcast, and one "usable host" — the address itself.
Does this calculator handle IPv6?
No. This is IPv4 only. IPv6 uses 128-bit addresses and a different notation (e.g. 2001:db8::/32), with no broadcast at all and a much larger usable host range. A dedicated IPv6 subnet calculator is on the build queue; the maths is broadly similar but requires 128-bit arithmetic, which JavaScript needs BigInt for.