ipcalc

IP subnet calculator for IPv4 and IPv6. Quickly answers “what network is this address in?”

Category: Networking / Addressing Subnetting IPv4 IPv6 Planning

What it does

ipcalc calculates network information from an IP address and prefix or netmask. It outputs network address, broadcast address, usable host range, and related metadata.

How it works (mechanical)

ipcalc applies bitwise operations to IP addresses and subnet masks to determine network boundaries. It supports both CIDR notation and dotted-decimal netmasks, and many implementations handle IPv6 natively.

  • Bitwise AND to compute network address
  • Bitwise OR to compute broadcast address (IPv4)
  • Prefix math to determine host ranges
  • Pure calculation — no system state is modified

10 Practical Examples

# 1) Basic IPv4 calculation
ipcalc 192.168.1.10/24
# 2) Use dotted-decimal netmask
ipcalc 192.168.1.10 255.255.255.0
# 3) Show network and broadcast only
ipcalc -n -b 10.0.5.23/16
# 4) Calculate host range
ipcalc -h 172.16.8.44/20
# 5) IPv6 subnet calculation
ipcalc 2001:db8::1/64
# 6) Split a network into subnets
ipcalc -s 4 192.168.0.0/24
# 7) Show prefix length only
ipcalc -p 192.168.1.10/26
# 8) Quiet mode (script-friendly)
ipcalc -q 10.1.2.3/22
# 9) Validate an address and prefix
ipcalc -c 192.168.1.0/33
# 10) Use in shell scripts
ipcalc -n 10.0.0.5/8 | awk '/Network/{print $2}'

Notes & Gotchas

  • Different distributions ship different ipcalc variants.
  • Option flags may vary slightly (check ipcalc --help).
  • Broadcast address applies only to IPv4.
  • IPv6 output varies depending on implementation.
  • Safe to use in scripts — no side effects.

Historical Context

ipcalc emerged as CIDR replaced classful networking, giving administrators a fast way to reason about subnets without manual binary math.

Modern Equivalent / Related Tools

  • sipcalc — extended subnet calculator
  • ip route — kernel routing table inspection
  • nmap — network discovery and mapping
  • whois — ASN and allocation lookup
  • online subnet calculators — quick reference