IP Subnet Calculator

About this calculator

The IP Subnet Calculator turns an IP address and a prefix length (CIDR) into everything you need to plan a network: the network and broadcast addresses, the usable host range, the number of hosts, the subnet and wildcard masks, the binary forms and the full list of sibling subnets.

Switch to IPv6 to get the full expanded address, the network, the address range, the total number of addresses and the number of /64 networks, calculated with exact big-integer arithmetic.

Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

What an IP subnet calculator does

Every IPv4 address has 32 bits. A subnet mask, or its shorter CIDR form such as /24, says how many of those bits identify the network and how many identify a device on it. The calculator applies the mask to your address to find where the network starts, where it ends and which addresses in between can be handed to devices.

The formulas

network = address AND mask
broadcast = network OR (NOT mask)
total addresses = 2(32 - prefix)
usable hosts = total - 2 (for prefixes up to /30)

The first address of a subnet is the network address and the last is the broadcast address. Neither can be assigned to a host, which is why a /24 holds 256 addresses but only 254 usable ones. The wildcard mask is the inverse of the subnet mask and is used in router access lists and OSPF configuration.

Worked example

Take 192.168.1.0 with a /24 prefix. The mask is 255.255.255.0, which is 11111111.11111111.11111111.00000000 in binary. The network address is 192.168.1.0, the broadcast address is 192.168.1.255 and the usable range is 192.168.1.1 to 192.168.1.254, a total of 254 hosts. The wildcard mask is 0.0.0.255.

Now take 10.1.2.77 with a /20 prefix. The mask is 255.255.240.0, so the third octet is cut into blocks of 16. The address sits in the block starting at 10.1.0.0, which runs to 10.1.15.255 and offers 4,094 usable hosts.

Common prefix sizes

PrefixSubnet maskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/24255.255.255.0256254
/26255.255.255.1926462
/28255.255.255.2401614
/30255.255.255.25242

Special cases: /31 and /32

A /32 identifies a single host, so there is no range to list. A /31 holds two addresses and is used on point-to-point links, where both addresses serve as hosts and no broadcast address is needed. In both cases the tool reports no usable range in the traditional sense.

Classful ranges and private space

Historically IPv4 was split into classes. Class A used the first octet 1 to 126, class B 128 to 191 and class C 192 to 223. Today networks use classless addressing, so the prefix length matters far more than the class. Three blocks are reserved for private networks and are not routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The tool labels an address Private when it lies inside one of those blocks and Public otherwise.

All the subnets in a block

When your prefix does not land on a whole octet, the tool lists every network of that size inside the enclosing block. A /28 inside 10.1.2.x, for example, produces 16 networks of 16 addresses each, starting at 10.1.2.0, 10.1.2.16, 10.1.2.32 and so on. This is the quickest way to plan how to carve one network into equal parts.

IPv6

IPv6 addresses have 128 bits, written as eight groups of four hexadecimal digits. A prefix such as /64 fixes the first 64 bits as the network and leaves 64 bits for hosts, which is 18,446,744,073,709,551,616 addresses. IPv6 has no broadcast address and no need to subtract two, so every address in the prefix counts. Consecutive groups of zeros may be shortened to a single double colon, so 2001:0db8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1. The calculator shows both the compressed and expanded forms.

Tips for planning

  • Size each subnet for growth. A subnet that is full cannot be extended without renumbering.
  • Keep subnet sizes to powers of two and align them on their own boundary.
  • Reserve the first or last usable address for the gateway and document it.
  • For IPv6, use /64 for ordinary LAN segments and /48 for sites.

Reading the extra fields

Besides the host range, the result lists several alternative forms of the same address. The binary ID and integer ID are the address written as a 32 bit string and as a single decimal number, which some databases and firewalls use to store addresses. The hex ID is the same value in hexadecimal. The in-addr.arpa entry is the name used for reverse DNS lookups, with the octets written backwards. The IPv4 mapped address and the 6to4 prefix show how the address would be written inside IPv6.

Frequently asked questions

How many usable hosts are in a /24?
A /24 has 256 addresses and 254 usable hosts. One address is the network address and one is the broadcast address.
What is the wildcard mask?
It is the bitwise inverse of the subnet mask. For 255.255.255.0 the wildcard mask is 0.0.0.255. Routers use it in access lists and routing protocol configuration.
What does CIDR notation mean?
CIDR notation writes the subnet mask as the count of leading one bits. /24 means the first 24 bits are the network, equal to 255.255.255.0.
Why are there no usable hosts in a /31 or /32?
A /32 is a single address and a /31 is a two address point-to-point link, so the standard network and broadcast subtraction leaves no usable range.
How many addresses are in an IPv6 /64?
A /64 contains 2 to the power of 64, which is 18,446,744,073,709,551,616 addresses.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.