High-performance, zero-dependency Go CLI and library for Site Reliability Engineers, cloud architects, and systems developers. Decompose arbitrary IPv4/IPv6 ranges into minimal CIDR blocks, detect collisions, carve subnets, and export directly for Terraform and AWS.
brew install smford/tap/cidr-calculator
Test CIDR decomposition and range intelligence directly in your browser. Real-time dual-stack calculations.
192.168.1.10/31 192.168.1.12/30
Zero external Go runtime dependencies, fully tested with race detection, sub-millisecond execution.
Computes the exact minimal set of power-of-two prefix blocks for any arbitrary contiguous range of IP addresses with mathematically optimal bitmasking.
First-class 128-bit math supports both standard IPv4 and IPv6 subnets, compressed hexadecimal addresses, and global unicast CIDRs.
Merges adjacent or overlapping CIDR blocks into their minimal superset (e.g. coalescing adjacent /24 subnets into /23s or /22s).
Detect IP address overlaps across VPCs and subnet allocations with exact intersection intervals. Returns clean non-zero exit codes for CI/CD gates.
Carve out reserved gateway IPs, DHCP pools, or Kubernetes node ranges from base subnets, returning the remaining optimal CIDR blocks.
Native presets for Terraform HCL lists (-format=terraform), AWS Security Group Ingress JSON rules (-format=aws), JSON, and CSV spreadsheets.
Simple, Unix-philosophy command line interface designed for pipe-friendly shell workflows.
cidr-calculator 192.168.1.10+5
cidr-calculator -format=terraform 192.168.1.10+5
aggregate)
Merge overlapping and contiguous CIDR blocks
cidr-calculator aggregate 10.0.0.0/24 10.0.1.0/24 10.0.0.128/25
overlap)
Check for IP collision between two networks (exit code 1 if colliding)
cidr-calculator overlap 10.100.0.0/16 10.100.32.0/20
contains)
Check if a supernet or VPC completely encapsulates a target range
cidr-calculator contains 10.0.0.0/16 10.0.5.1
exclude)
Subtract excluded IP ranges from a base subnet
cidr-calculator exclude 192.168.1.0/24 192.168.1.1 192.168.1.100-192.168.1.150
split)
Subdivide a parent network into smaller equal prefixes
cidr-calculator split 10.0.0.0/22 /24
convert)
Convert IPv4 between integer, hex, binary, and dotted quad
cidr-calculator convert 3232235786