Calculate subnet

Calculate IPv4 network, broadcast, usable range, and host count from CIDR.

freeworks offlinenothing uploaded
ToolSubnet Calculator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

An address and prefix become 32-bit values. Masking derives network and broadcast, and conventional IPv4 rules derive first and last usable addresses and wildcard mask.

  • CIDR defines the boundary.
  • Usable counts exclude special addresses on traditional subnets.

Worked example

Calculate subnet for 192.168.1.0/24
Get network, broadcast, host range, mask, class, and binary for a /24 subnet
Input
											192.168.1.0/24
										
Output
												Network address: 192.168.1.0
Broadcast address: 192.168.1.255
Subnet mask: 255.255.255.0
Wildcard mask: 0.0.0.255
CIDR: 24
First host: 192.168.1.1
Last host: 192.168.1.254
Total hosts: 256
Usable hosts: 254
IP class: C
Is private: yes
Binary mask: 11111111.11111111.11111111.00000000
IP binary: 11000000.10101000.00000001.00000000
											

When to use this

VLAN planning, firewall summaries, and IPAM allocation calculate subnets.

Edge cases

  • /31 point-to-point networks have special host rules.
  • /32 represents one address without a conventional host range.
  • IPv6 has no IPv4 broadcast and needs separate logic.

References