IP Subnet Calculator

Calculate subnet masks, network addresses, address ranges, and other subnet details for IPv4 and IPv6 using CIDR prefixes.

Enter an IPv4 address (like 192.168.1.10) and a CIDR prefix length from 0 to 32 (like 24, for a 255.255.255.0 mask).
Enter an IPv6 address and a prefix length from 0 to 128. IPv6 has no broadcast address (it uses multicast instead), so there's no broadcast row here the way there is for IPv4.
Result Live

How to find the subnet mask of an IP address

An IP address on its own doesn't tell you its subnet mask — the mask (or its shorthand, the CIDR prefix like /24) has to come from somewhere else: it's assigned alongside the address, either by whoever configured the network or by documentation like a router's DHCP settings. Once you know the prefix length, the subnet mask follows directly: it's a run of that many 1 bits from the left, followed by 0 bits to fill out the remaining length (32 bits for IPv4, 128 for IPv6). A /24 means 24 one-bits followed by 8 zero-bits, which written out in IPv4's dotted-decimal form is 255.255.255.0. Enter your address and prefix above and the calculator does that conversion instantly, in either direction.

Common IPv4 CIDR prefixes

CIDR Subnet Mask Usable Hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522
/31 255.255.255.254 2*
/32 255.255.255.255 1*

Footnotes

  1. /31 subnets can use both addresses for point-to-point links. /32 represents a single host route.

IPv4 vs. IPv6 subnetting

IPv4 subnets have a network address, a broadcast address, and a range of usable addresses in between (the network and broadcast addresses themselves aren't assignable to a host, except in the special case of a /31 point-to-point link). IPv6 has no broadcast address; multicast is used instead. The calculator therefore shows the first and last address in the subnet rather than a traditional broadcast/usable-host range. IPv6 subnets are also almost always vastly larger than anything used in IPv4; a standard /64 contains 18,446,744,073,709,551,616 addresses on its own.

Frequently asked questions

How do you find the subnet mask of an IP address?

You need the CIDR prefix length (like /24) alongside the address, since the mask isn't derivable from the address alone. Once you have the prefix, the mask is that many 1 bits followed by 0 bits — /24 becomes 255.255.255.0 in IPv4's dotted-decimal notation.

What is the difference between a network address and a broadcast address?

The network address is the first address in a subnet (all host bits set to 0), used to identify the subnet itself. The broadcast address is the last (all host bits set to 1), used to send a message to every host on that subnet at once. In traditional IPv4 subnets, neither is normally assigned to an individual host. A /31 point-to-point subnet is a special case where both addresses can be used.

Does IPv6 have a broadcast address?

No. IPv6 does not have a broadcast address. It uses multicast instead. Unlike traditional IPv4 subnetting, IPv6 does not reserve a network address and broadcast address from each subnet as a general rule.

What is a /30 subnet mask?

A /30 IPv4 prefix has the subnet mask 255.255.255.252. It provides 4 total addresses: one network address, two traditionally usable host addresses, and one broadcast address. For example, 192.168.1.0/30 contains 192.168.1.0 through 192.168.1.3.

How many usable hosts are in a /24 subnet?

A /24 IPv4 subnet has 256 total addresses and 254 traditionally usable host addresses. The network address and broadcast address account for the two addresses that aren't normally assigned to hosts.