IPv4 Subnet Calculator

From an address and a prefix or mask: network, broadcast, host range, number of hosts, and whether the address is private.

Runs entirely in your browser. Nothing is uploaded, logged or stored.

For example 192.168.1.10/24, or 192.168.1.10 255.255.255.0.

Network

192.168.1.0/24

Subnet mask
255.255.255.0
Broadcast address
192.168.1.255
Usable addresses
192.168.1.1 – 192.168.1.254
Number of hosts
254
Addresses in the network
256
Wildcard mask
0.0.0.255
Kind of address
Private (RFC 1918)

Enter an address with its prefix — 192.168.1.10/24 — or with its mask, and this gives the network it belongs to, its broadcast address, the range of addresses a host can take, how many there are, and whether the address is private, public or reserved.

How it works

The prefix says how many of the 32 bits of an address name the network: /24 keeps the first 24 and leaves 8 for hosts, which is the mask 255.255.255.0. The network is the address with the host bits cleared, the broadcast the same with them all set.

A network of 2 to the power of its host bits addresses has two fewer hosts, because its first address names the network and its last is the broadcast. Two sizes are exceptions by standard: a /31 is a point-to-point link whose two addresses are both usable, and a /32 is a single host.

The kind of address comes from the IANA registry of special-purpose addresses: private ranges, loopback, link-local, documentation, multicast and the rest. Anything outside them is public.

Examples

Case Input Result
A home network 192.168.1.10/24 192.168.1.0/24, 192.168.1.1 – 192.168.1.254, 254 hosts, private
The same with a mask 10.20.30.40 255.255.240.0 10.20.16.0/20, 4,094 hosts
A point-to-point link 203.0.113.6/31 203.0.113.6 – 203.0.113.7, 2 hosts

Frequently asked questions

How many hosts does a /24 have?

254. A /24 has 256 addresses; the first is the network and the last the broadcast, which leaves 254 for hosts. Each step down in prefix doubles the addresses, and the hosts with them less those two: a /23 has 510, a /22 1,022.

Which addresses are private?

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16, set aside by RFC 1918 for networks that are not reached directly from the internet. 100.64.0.0/10 is a separate block that internet providers use behind carrier-grade NAT.

What is a wildcard mask?

The mask with every bit flipped: 0.0.0.255 for 255.255.255.0. Some router and firewall rules are written with it instead of the mask.

Good to know

  • IPv4 only. An IPv6 address is refused rather than read: its prefixes, its special blocks and the absence of a broadcast make it a different calculation.

Sources

All Code tools