Help

Subnet Calculator

This subnet calculator turns an IP address and a CIDR prefix into the network address, broadcast address, usable host range, subnet mask, wildcard mask and host count. IPv4 and IPv6 go in the same field, and the answer updates on every keystroke, so there is no button to press. A binary view shows where the network ends and the host part begins. The numbers are worked out in your browser and nothing is sent anywhere.


How to calculate a subnet from an IP address and prefix

The page opens with 192.168.1.10/24 already filled in, so you can see a full result before you type anything.

  1. Type an address and a prefix into IP address and prefix, for example 10.0.0.77/27 or 2001:db8::1/64. The slash and prefix are optional: with no prefix the calculator uses /24 for IPv4 and /64 for IPv6.
  2. Or drag the Prefix length slider under the field. It runs from 0 to 32 for IPv4 and 0 to 128 for IPv6, and it rewrites only the number after the slash, keeping the address as you typed it.
  3. Read the result cards. The bar at the top names what the calculator understood, for example "IPv4 · /24", and says "Type an address to calculate" while the field is empty.
  4. Press Copy on any card to copy that one value, ready to paste into a router config, a firewall rule or a cloud console.

What each IPv4 result means

For an IPv4 address the calculator shows six cards. The example column is the result for 192.168.1.10/24.

CardWhat it tells you192.168.1.10/24
Network addressThe first address of the subnet, with every host bit set to 0. It names the subnet.192.168.1.0
Broadcast addressThe last address of the subnet, with every host bit set to 1.192.168.1.255
Usable rangeThe first and last address you can give to a device.192.168.1.1 - 192.168.1.254
Subnet maskThe prefix written in dotted decimal.255.255.255.0
Wildcard maskThe subnet mask inverted. 0 bits must match, 1 bits are ignored.0.0.0.255
Usable hostsHow many addresses can be assigned.254

The address you type does not have to be the network address. Enter any host inside the block, such as 172.16.5.9/20, and the calculator finds the subnet it belongs to: 172.16.0.0 to 172.16.15.255, 4,094 usable hosts.

CIDR to subnet mask: common prefixes

If you only need to convert a prefix to a mask, this table covers the sizes people look up most. Type any of them after a slash to check the full result, or use the slider to step through the rest.

PrefixSubnet maskWildcard maskUsable hosts
/16255.255.0.00.0.255.25565,534
/20255.255.240.00.0.15.2554,094
/24255.255.255.00.0.0.255254
/26255.255.255.1920.0.0.6362
/27255.255.255.2240.0.0.3130
/28255.255.255.2400.0.0.1514
/29255.255.255.2480.0.0.76
/30255.255.255.2520.0.0.32

The host count for any IPv4 prefix n from 0 to 30 is 232-n minus 2: the network address and the broadcast address are not given to hosts. A /27 such as 10.0.0.77/27 lands in the block 10.0.0.64 to 10.0.0.95, with hosts 10.0.0.65 to 10.0.0.94.

/32 and /31 subnets: single hosts and point-to-point links

The two smallest IPv4 sizes break the "minus 2" rule, and the calculator handles both.

IPv6 subnet calculator: prefixes from /0 to /128

Type an IPv6 address and the cards change to the ones that make sense there: Network address, Last address, Usable range, Subnet mask and Total addresses. IPv6 has no broadcast address, so the last address is just the end of the block, and the whole block counts as usable.

For 2001:db8::1/64 the network address is 2001:db8::, the last address is 2001:db8::ffff:ffff:ffff:ffff, the mask is ffff:ffff:ffff:ffff:: and the block holds 18,446,744,073,709,551,616 addresses. The count is exact for every prefix, even /0 with its 2128 addresses, because it is calculated with whole numbers rather than floating point.

The field accepts the :: shorthand, upper or lower case, and IPv4-mapped forms such as ::ffff:192.0.2.1. Results are written in the compressed lower-case form.

Show binary: see where the network boundary falls

Tick Show binary under the results to open a Binary section with two rows, Address and Mask. IPv4 is split into four 8-bit groups and IPv6 into eight 16-bit groups. Bold bits are the network part and grey bits are the host part, so the point where the mask changes from 1s to 0s is also where the bold stops. For 192.168.1.10/24 the address row reads 11000000 10101000 00000001 00001010 and the first three groups are bold. Drag the slider to a /27 and the first three bits of the last group turn bold too.

Errors you may see

What this subnet calculator does not do

It calculates one block at a time. It does not accept a mask such as 255.255.255.0 in place of /24, it does not split a block into smaller subnets or plan VLSM layouts, and it does not look up your own address. To find the address your connection is using, the My IP tool shows it with a Copy button, and you can paste it here with a prefix. For converting the hex groups of an IPv6 address by hand, a hex to decimal converter does the arithmetic.


Frequently asked questions

How do I calculate a subnet from an IP address and CIDR prefix?

Type the address and prefix into IP address and prefix, for example 192.168.1.10/24. The calculator keeps the first 24 bits as the network part and sets the rest to 0 for the Network address and to 1 for the last address. The Usable range, Subnet mask and Wildcard mask follow from the same prefix. Everything updates as you type.

How many usable hosts are in a /24?

254. A /24 holds 256 addresses, and the first (the network address) and the last (the broadcast address) are not given to hosts, so the usable range runs from .1 to .254. The general rule for IPv4 is 2 to the power of (32 minus the prefix), minus 2.

What is a /32 subnet?

A /32 is one address and nothing else: all 32 bits are the network part. The calculator shows the single address as the Network address, the broadcast address and both ends of the Usable range, and reports 1 usable host with a note that a /32 is a single host address. Routes to one machine and loopback addresses are written this way.

What is a wildcard mask?

A wildcard mask is the subnet mask turned inside out: 0 bits must match and 1 bits are ignored. For /24 the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Access lists and OSPF network statements on routers use the wildcard form, and the Wildcard mask card shows it for any IPv4 prefix.

How many addresses are in an IPv6 /64?

18,446,744,073,709,551,616, which is 2 to the power of 64. For IPv6 the calculator counts every address in the block exactly, using whole-number arithmetic with no rounding, and shows it as Total addresses. A /64 is the standard size for a single IPv6 network segment.

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

The network address is the first address of a subnet and names the subnet itself, with every host bit set to 0. The broadcast address is the last address, with every host bit set to 1. In IPv4 neither is given to a host (except in /31 and /32 subnets). IPv6 has no broadcast address, so the calculator labels it Last address instead.

Can I enter a subnet mask like 255.255.255.0 instead of /24?

No. The field takes an address with a prefix length, such as 192.168.1.10/24, or an address on its own. To go from a mask to a prefix, count the 1 bits in the mask: 255.255.255.0 has 24, so it is /24. The Subnet mask card shows the mask for any prefix you enter.

Is the address I enter sent anywhere?

No. The numbers are worked out by your browser on this page and nothing is uploaded or stored. There is no account and no sign-up.


Recommended

Helps keep the tools free. ✨

Images are for illustration only. As an Amazon Associate I earn from qualifying purchases.