IPv4 Subnet Calculator
Network, broadcast, host range and masks from any IPv4 and CIDR.
IPv4 subnet calculator
How it works.
A subnet is a block of IP addresses that share the same network part. The prefix length - the /24 in 192.168.1.10/24 - says how many of the 32 bits in an IPv4 address belong to the network; the remaining bits number the hosts inside it. Type an address with a prefix (or pick a mask from the list) and the calculator shows the network address, broadcast address, first and last usable host, how many hosts fit, and the masks in every common notation.
In a normal subnet the first address is the network address and the last is the broadcast address, so neither can be given to a device. That's why a /24 has 256 addresses but 254 usable hosts, and a /30 has 4 addresses but only 2 usable. Two special cases are handled as the standards define them: a /31 has no network or broadcast address, so both addresses are usable on point-to-point links (RFC 3021), and a /32 is a single host.
The subnet mask (for example 255.255.255.0) and the CIDR prefix (/24) say the same thing in different formats. The wildcard mask is its inverse (0.0.0.255) and is what Cisco ACLs, OSPF network statements and many firewall rules expect. The binary view shows exactly where the network bits end and the host bits begin, which is the quickest way to understand why a given address does or doesn't fall inside a range.
The calculator also tells you what kind of address you entered. Private ranges from RFC 1918 - 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 - are for internal networks and are never routed on the internet. 100.64.0.0/10 is reserved for carrier-grade NAT, 169.254.0.0/16 is link-local (what a device gives itself when DHCP fails), 127.0.0.0/8 is loopback, and 224.0.0.0/4 is multicast. The legacy A/B/C class is shown for reference, although modern networks use classless (CIDR) addressing.
Good subnetting keeps networks fast and secure. Separating staff, guests, cameras, phones and servers into their own VLANs and subnets limits broadcast traffic, contains problems, and lets firewalls apply different rules to each group. For guest Wi-Fi and hotspots, size the subnet for peak connected devices, not users - each guest may bring a phone, a laptop and a tablet - and keep DHCP lease times short so addresses free up quickly.
Everything is calculated locally in your browser, so you can use it on any network, including ones you're still building. When you're ready to design or rebuild the network itself - VLANs, routing, firewalls, Wi-Fi and structured cabling - our network infrastructure team can help.
Questions, answered.
How do I calculate a subnet from an IP and CIDR?
Enter the address with its prefix, for example 10.20.30.40/22. The calculator keeps the first 22 bits as the network (10.20.28.0), sets all host bits to 1 for the broadcast (10.20.31.255), and shows the usable range between them (10.20.28.1 to 10.20.31.254) - 1,022 hosts.
How many usable hosts are in a /24?
A /24 has 256 addresses. The first is the network address and the last is the broadcast, so 254 can be assigned to devices. In general a subnet with prefix n has 2^(32-n) addresses and 2^(32-n) - 2 usable hosts, except /31 (2 usable) and /32 (1).
What is a wildcard mask?
It's the subnet mask with every bit flipped: 255.255.255.0 becomes 0.0.0.255. Router access lists and routing protocols such as OSPF use wildcard masks to say which bits must match.
Which IP ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. Addresses in these ranges work inside your LAN and are translated to a public address by your router when they reach the internet.
Can I type a dotted mask instead of a prefix?
Yes. You can enter 192.168.1.10/255.255.255.0, put a space between the address and mask, or type just the address and choose the mask from the list. Masks must have contiguous ones, so values such as 255.0.255.0 are rejected.
Does the calculator support IPv6?
No - this calculator is for IPv4. IPv6 LANs normally use a fixed /64 per subnet, so planning works differently and the host-count maths above doesn't apply.