Skip to content

IPv4 Subnet Calculator

Calculate network address, broadcast address, host range, subnet mask, and wildcard mask from any IP and CIDR prefix.

IPv4 Subnet Calculator tool

Loading...

Example

Input: 192.168.1.0/24

Result: Network 192.168.1.0, Broadcast 192.168.1.255, hosts 192.168.1.1 - 192.168.1.254, Total Hosts 254, Mask 255.255.255.0, Wildcard 0.0.0.255

A /24 leaves 8 host bits, so the block holds 2^8 = 256 addresses. The first (network) and last (broadcast) are reserved, leaving 254 usable hosts.

CIDR Prefixes, Subnet Masks and Host Counts

PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/12255.240.0.01,048,5761,048,574
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Usable hosts as the calculator counts them, including the /31 (RFC 3021) and /32 special cases.

  1. Enter an IPv4 address in dotted-decimal notation (for example 10.0.0.1).
  2. Pick a CIDR prefix from the list (for example /24 for 255.255.255.0), or type it after the address as 10.0.0.1/24.
  3. Read the network address, broadcast address, first and last usable host, and the host count.
  4. Check the subnet mask in dotted-decimal form and the class (A, B, C, D or E) of the address.
  5. Use the wildcard mask for router and firewall access lists, and copy any value with its copy button.

How IPv4 Subnetting and CIDR Prefixes Work

A subnet calculator tells you which addresses belong to a network. Enter an IP address and a prefix such as /24, and it shows the network and broadcast addresses, the usable host range, the host count, the subnet mask and the wildcard mask. For 192.168.1.100/24, the network is 192.168.1.0 and hosts run from .1 to .254.

The prefix is the number of bits that name the network. The rest name the host. A /24 leaves 8 host bits, so the block holds 2^8 = 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 for devices. Each extra bit in the prefix halves the block: a /25 gives 126 usable hosts and a /26 gives 62.

Two prefixes break that rule, and the calculator handles both. A /31 has only two addresses, and RFC 3021 lets both be used on a link between two routers, so the tool shows 2 hosts. A /32 is a single host, often used for loopbacks and firewall rules, so it shows 1.

You can type the prefix after the address (10.0.0.5/20) or pick it from the list. The wildcard mask is the subnet mask with every bit flipped, so 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF use it. The tool also shows the old class (A to E) of the address, which no longer affects routing but still comes up in exams and older docs.

To list every address in a block, use the IPv4 Range Expander. To see the binary behind an address, try the IPv4 Address Converter.

Sources

Frequently Asked Questions

A /24 has 254 usable hosts, a /25 has 126 and a /26 has 62. The rule is 2 to the power of (32 minus the prefix), minus 2 for the network and broadcast addresses. The exceptions are /31, which gives 2 usable addresses on point-to-point links, and /32, which is a single host.
A /24 is 255.255.255.0: 24 one-bits followed by 8 zero-bits. Other common ones are /16 = 255.255.0.0, /8 = 255.0.0.0, /27 = 255.255.255.224 and /30 = 255.255.255.252. The table on this page lists the mask, the address count and the usable hosts for the prefixes you are most likely to need.
A wildcard mask is the subnet mask inverted: every 1 becomes 0 and every 0 becomes 1, so 255.255.255.0 becomes 0.0.0.255. Cisco access control lists and OSPF network statements use it. A 0 bit means the address bit must match, and a 1 bit means any value is fine. The calculator shows it next to the normal mask.
Do a bitwise AND of the address and the mask. Where the mask has a 1 you keep the address bit, and where it has a 0 you get 0. For 10.0.0.5/20 the mask is 255.255.240.0, so the network is 10.0.0.0 and the broadcast is 10.0.15.255. The calculator does this for any prefix from /0 to /32.
Not for routing. Classful addressing (A, B and C) was replaced by CIDR in 1993, so any prefix length can be used with any address. Classes still appear in exam questions and older documentation, which is why the calculator reports one. Class D (224 to 239) is still used for multicast, and class E (240 and up) is reserved.

Related Tools

IPv4 Address Converter

Convert IPv4 addresses between decimal, binary, hexadecimal, and integer representations instantly.

Network Tools

IPv4 Range Expander

Expand CIDR notation or IP address ranges into a complete list of individual IP addresses.

Network Tools

IPv6 ULA Generator

Generate unique local IPv6 addresses (ULA) per RFC 4193 with cryptographically random prefixes.

Network Tools

Number Base Converter

Convert numbers between binary, octal, decimal, hexadecimal, and any custom base.

Math and Numbers

MAC Address Generator

Generate random MAC addresses with optional OUI prefix in colon, hyphen, or dot notation formats.

Network Tools

Random Port Generator

Generate random port numbers within specified ranges for development, testing, and network configuration.

Network Tools