IP Subnet Calculator

Network, broadcast, host range and mask for any IPv4 or IPv6 prefix.

IPv4 or IPv6. You can type the prefix too, like 10.0.0.5/8.

0–32 for IPv4 (or a mask), 0–128 for IPv6.

Examples

Network

192.168.1.0/24

192.168.1.10/24 is in network 192.168.1.0/24: 254 usable hosts, 192.168.1.1 to 192.168.1.254.

Network address
192.168.1.0
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
Total addresses
256
Subnet mask
255.255.255.0 (/24)
Wildcard mask
0.0.0.255
Address range
192.168.1.0 – 192.168.1.255
Address type
Private (RFC 1918)
Historic class
C

Fix the highlighted field to update the result.

Show the binary

The bars mark the prefix: network bits on the left, host bits on the right.

Address   11000000.10101000.00000001 | 00001010
Mask      11111111.11111111.11111111 | 00000000
Network   11000000.10101000.00000001 | 00000000
Broadcast 11000000.10101000.00000001 | 11111111

How to use

  1. Enter an IP address, such as 192.168.1.10. You can type the prefix too, like 10.0.0.5/8.
  2. Enter the prefix length (like 24) or the subnet mask (like 255.255.255.0).
  3. Read the network, broadcast, first and last usable host, host count, mask and wildcard. Open Show the binary to see the working.

IPv6 works the same way: enter an address such as 2001:db8::1 with a prefix like 64. Everything runs in your browser.

How subnetting works

An IPv4 address is 32 bits. The prefix (/n) says how many of the first bits name the network; the rest number the hosts (RFC 4632).

  1. Mask: n ones followed by zeros. /20 is 255.255.240.0.
  2. Network address: the IP AND the mask (host bits set to 0).
  3. Broadcast address: the network with every host bit set to 1.
  4. Usable hosts: 2^(32 − n) − 2, because the network and broadcast addresses can’t be given to hosts.

Two exceptions: a /31 point-to-point link uses both of its addresses (RFC 3021), and a /32 is a single address.

Example

172.16.5.4/20 in binary, with a bar after the first 20 bits:

Address   10101100.00010000.0000 | 0101.00000100
Mask      11111111.11111111.1111 | 0000.00000000
Network   10101100.00010000.0000 | 0000.00000000

So the network is 172.16.0.0/20, the broadcast is 172.16.15.255, and the 4,094 usable hosts run from 172.16.0.1 to 172.16.15.254.

Common prefixes

Prefix Subnet mask Addresses Usable hosts
/8 255.0.0.0 16,777,216 16,777,214
/16 255.255.0.0 65,536 65,534
/22 255.255.252.0 1,024 1,022
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2
/32 255.255.255.255 1 1
Wildcard masks, private ranges and IPv6
  • Wildcard mask: the subnet mask with every bit flipped (0.0.15.255 for /20), as used in Cisco access lists.
  • Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. 100.64.0.0/10 is shared carrier-grade NAT space (RFC 6598).
  • IPv6 addresses are 128 bits. A /64, the usual subnet size, holds 18,446,744,073,709,551,616 addresses. Results use the short form from RFC 5952, such as 2001:db8::1.

Want to see an address as one binary or hex number? Convert each part with the number base converter.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 has 2⁸ = 256 addresses, minus the network address (all host bits 0) and the broadcast address (all host bits 1).

What is the subnet mask for /24?

255.255.255.0: the first 24 bits are ones. A /26 is 255.255.255.192 and a /30 is 255.255.255.252.

How do I find the network address?

Do a bitwise AND of the IP address and the subnet mask. 192.168.1.10 AND 255.255.255.0 gives 192.168.1.0.

Can I use a /31 subnet?

Yes, on point-to-point links. RFC 3021 lets both addresses of a /31 be hosts, because such a link needs no broadcast address.

What is a wildcard mask?

The subnet mask with every bit flipped: 0.0.0.255 for a /24. Cisco access lists use it to say which bits may vary.

How many addresses does an IPv6 /64 hold?

2⁶⁴, about 18.4 quintillion (18,446,744,073,709,551,616). A /64 is the usual size of one IPv6 subnet.