IPv4 netmask calculator

Why use this calculator?

Calculate in one click the network, mask, broadcast and usable address range of an IPv4.
Useful for setting an ACL, choosing a gateway, creating a VLAN, documenting an addressing plan or checking a configuration provided by an operator.
The tool accepts a single IP with CIDR prefix 192.168.1.42/24 or a network/prefix pair 192.168.1.0/24.

What the tool returns

  • Mask in CIDR and decimal notation 255.255.255.0
  • Network address and broadcast address
  • First and last usable addresses
  • Number of usable hosts
  • "Wildcard mask" 0.0.0.255 useful for some ACLs

How to use

  1. Enter an address in IPv4 format or directly a CIDR block.
  2. Click Calculate.
  3. Read the summary and copy what you need.

Tip
If you enter an IP with a prefix 203.0.113.9/30, the calculation is done on the block to which this IP belongs.

Quick reminders about CIDR

  • /24 equals 255.255.255.0 and contains 256 addresses of which 254 are usable.
  • /30 block of 4 addresses. 2 usable. Ideal for router to router links.
  • /31 block of 2 addresses. 2 usable without broadcast on RFC 3021 compatible equipment.
  • /32 single address. Used to designate a host.

Concrete examples

192.168.1.42/24
Network 192.168.1.0
Broadcast 192.168.1.255
Usable range 192.168.1.1 → 192.168.1.254
Hosts 254
203.0.113.9/30
Network 203.0.113.8
Broadcast 203.0.113.11
Usable range 203.0.113.9 → 203.0.113.10
Hosts 2

Private ranges and special addresses

These addresses are not routed on the Internet. They are designed for internal networks.

Private

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
169.254.0.0/16

Loopback

127.0.0.0/8

CGNAT operator side

100.64.0.0/10

Documentation and public testing

192.0.2.0/24
198.51.100.0/24
203.0.113.0/24

Multicast

224.0.0.0/4

Historical reserved

0.0.0.0/8
240.0.0.0/4

Limited broadcast

255.255.255.255

Good to know
A private address behind a box cannot directly receive connections from the Internet without translation and appropriate rules.

When to use it?

  • Size a subnet and know exactly the usable range.
  • Check that a block provided by a service provider matches your host needs.
  • Prepare firewall rules with network, mask and wildcard.
  • Check an addressing plan before deployment or migration.
  • Explain an outage due to a broadcast IP or an incorrect mask.

Best practices

  • Choose a prefix that leaves a reasonable margin of hosts. Neither too wide nor too tight.
  • Avoid using the network address and broadcast address.
  • Clearly reserve the gateway. In practice often .1 or .254, but it's up to you.
  • Note the TTL of DNS records if you change the addressing of an exposed service.
  • Document each network block and the allocation date.

Points of attention

  • /31 is not universal. Check support on your routers before use.
  • Inconsistent masks on either side of a link create random losses.
  • IP geolocation databases do not depend on the mask. A change of operator can move the perceived location.
  • Private and CGNAT ranges are not valid for publishing a public service.