Skip to content

IP Subnet Calculator

This IP subnet calculator works out the network, broadcast and usable host range for an IPv4 address and its CIDR prefix. It also gives the subnet mask and wildcard mask used in router and firewall rules. IPv6 is not supported.

Network (CIDR)

192.168.1.0/24

Usable hosts run from 192.168.1.1 to 192.168.1.254.

Network address
192.168.1.0
Broadcast address
192.168.1.255
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
More details
ItemValue
Address entered192.168.1.10
Binary subnet mask11111111.11111111.11111111.00000000
Total addresses256
IP classClass C
Address typePrivate (RFC 1918)

How to use this calculator

  1. 1 Type an IPv4 address. Add the prefix with a slash, such as /24, or leave it off.
  2. 2 If you left off the prefix, choose it from the Prefix length menu. The menu lists each mask beside its prefix.
  3. 3 Read the network, broadcast and usable host range. The details table shows the binary mask, the address class and the address type.

What is an IP address and a subnet?

An IPv4 address is a 32-bit number, written as four numbers from 0 to 255 separated by dots, such as 192.168.1.10. Every device on a network needs one, so that packets can find their destination.

A subnet is a block of addresses that share the same first part. The first part names the network, and the rest identifies a host inside it. The size of the first part is set by the prefix length.

Splitting a network into subnets keeps traffic organised and limits how far broadcasts travel. Offices, data centres and home networks all use subnets, often without the user noticing. More helpers for developers are in the developer tools section.

CIDR notation and the prefix

Classless Inter-Domain Routing (CIDR), described in RFC 4632, writes a network as an address and a prefix length, such as 192.168.1.0/24. The prefix is the number of leading bits that identify the network.

Before CIDR, addresses came in fixed classes, with the network size set by the first octet. The calculator still reports the class for reference, but modern networks use any prefix length, which gives more flexible block sizes.

A larger prefix means a smaller block. A /24 has 256 addresses, while a /16 has 65,536, and a /28 has only 16.

Common prefix lengths
PrefixSubnet maskTotal addressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/28255.255.255.2401614
/30255.255.255.25242
/32255.255.255.25511 (a single host)

Network, broadcast and usable hosts

The network address is the first address in the block. It is found by a bitwise AND of the address and the mask, which keeps the network bits and clears the rest. It names the subnet and cannot be given to a device.

The broadcast address is the last address in the block. Sending to it reaches every host on the subnet. The usable range sits between these two, which is why a /24 has 254 usable hosts rather than 256.

Two special cases apply. A /31 is a point-to-point link with two usable addresses, as RFC 3021 describes. A /32 is a single host route, with no separate network or broadcast address.

Private and special address ranges

RFC 1918 reserves three blocks for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These addresses are used inside homes and offices and are not routed on the public internet.

Some other ranges have special jobs. Addresses starting with 127 are loopback, which points back to your own machine. The 169.254 range is link-local, used when a device cannot get an address from a server.

Private addresses are often behind a router that uses network address translation, so many devices can share one public address. The table above shows which type your address belongs to. For how network speeds are measured, see the bandwidth calculator.

Tips for subnet planning

Mistakes in subnet plans cause outages that are hard to trace. Keep these points in mind:

  • Check the prefix first. A wrong prefix changes every other number.
  • Leave room to grow. Pick a block with spare addresses for future devices.
  • Avoid overlaps. Two networks with overlapping ranges cannot route to each other cleanly.
  • Reserve the edges. Do not assign the network or broadcast address to a device.
  • Learn the binary. The binary calculator shows how the mask bits line up with the address.

The formula

Subnet mask

mask = 2³² − 2^(32 − p)

p
prefix length, the number of network bits (0 to 32)

Network and broadcast

network = address AND mask, broadcast = network OR wildcard, wildcard = 2^(32 − p) − 1

AND, OR
bitwise operations on the 32-bit values
wildcard
the inverse of the subnet mask

Usable hosts

usable = 2^(32 − p) − 2 (p ≤ 30)

−2
removes the network and broadcast addresses
/31, /32
special cases: /31 has 2 usable addresses (RFC 3021), /32 has 1

Worked example

192.168.1.10 with prefix /24

  1. 1.Mask: 2³² − 2⁸ = 4,294,967,040, which is 255.255.255.0.
  2. 2.Network: 192.168.1.10 AND 255.255.255.0 = 192.168.1.0.
  3. 3.Broadcast: 192.168.1.0 OR 0.0.0.255 = 192.168.1.255.
  4. 4.Usable hosts: 2⁸ − 2 = 254, from 192.168.1.1 to 192.168.1.254.

Network 192.168.1.0/24 with 254 usable hosts.

Frequently asked questions

What does /24 mean?

The /24 is the prefix length: the first 24 bits identify the network and the last 8 bits identify hosts. It is the same as the subnet mask 255.255.255.0.

Why are the first and last addresses not usable?

The first address is the network address, which names the subnet, and the last is the broadcast address, which reaches every host. That is why a /24 has 254 usable hosts, not 256.

What is a wildcard mask?

It is the subnet mask flipped bit by bit. Routers and firewalls often use it in access control lists to match a range of addresses.

Which ranges count as private?

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. Other special ranges, such as shared address space 100.64.0.0/10, are also not public, and this tool does not flag them.

Can I use this calculator for IPv6?

No. It handles IPv4 addresses only. IPv6 addresses are longer, 128 bits, and use a different notation, so they need their own calculator.

Sources

Last reviewed by the GridCalculators team.