CIDR Calculator & Subnet Planner
Calculate CIDR ranges, subnet masks, usable IPs, hosts, gateways, IPv4/IPv6 subnets, CIDR splits, and Terraform cidrsubnet examples.
Quick Summary
cidrsubnet examples for AWS VPCs or local networks.What is this tool?
CIDR (Classless Inter-Domain Routing) notation is a compact way to specify an IP address and its associated routing prefix (e.g., 192.168.1.0/24). The number after the slash represents how many bits are fixed for the network, determining how many IP addresses are left for hosts.
A CIDR Calculator translates this slash notation into human-readable data: the subnet mask, the first and last usable IP addresses, the broadcast address, and the total host count. It is an essential tool for designing cloud architectures and preventing IP overlaps.
How to Use This Tool
- Input the Base CIDR: Enter an IP address with its CIDR block (e.g.,
10.0.0.0/16). - Calculate Subnet Data: The tool instantly calculates the network mask, broadcast address, and total usable host IPs.
- Split Subnets (Optional): Select a smaller subnet size (e.g.,
/24) to split the parent block into multiple child subnets. - Review the List: View the generated list of subnets to assign them to your VPC availability zones.
- Export: Download the subnet list as CSV or copy the Terraform
cidrsubnet()helper function.
What This Tool Generates
- CIDR network ranges (Start to End IP)
- Subnet masks (e.g.,
255.255.255.0) - Usable IP address counts
- Lists of split subnets
- Terraform
cidrsubnet()interpolation examples - CSV exports of your network topology
Example Output Explanation
A basic calculation for the CIDR block 10.0.0.0/24:
Network: 10.0.0.0
Subnet Mask: 255.255.255.0
First Usable: 10.0.0.1
Last Usable: 10.0.0.254
Broadcast: 10.0.0.255
Usable IPs: 254Best Practices
- AWS VPC Subnet Planning: AWS reserves the first four and the last IP address in every subnet (e.g., network, router, DNS, future use, and broadcast). Therefore, a /28 subnet in AWS only gives you 11 usable IPs, not 14.
- Terraform cidrsubnet Calculator: When using Infrastructure as Code, don't hardcode subnets. Use the cidrsubnet(prefix, newbits, netnum) function so your topology can scale dynamically without causing merge conflicts.
- IPv4 vs IPv6: IPv6 uses 128-bit addresses and /64 is the standard subnet size for a single LAN. Our tool supports the massive integer math required for IPv6 splits.
Common Mistakes
- Over-provisioning /16s: Assigning a massive /16 (65,536 IPs) to a single VPC is common, but assigning a /16 to a single subnet is dangerous. Always split your VPC into smaller /24s or /22s across multiple availability zones.
- Overlapping CIDR Blocks: If you plan to connect two VPCs via peering or Transit Gateway, their CIDR blocks must not overlap. Always use a CIDR planner to map out your global network architecture before deploying.
- Misunderstanding /32: A /32 means all 32 bits are fixed. It represents exactly one single IP address, typically used in firewall allow lists, not for networking subnets.
Security Notes
- Do not publicly expose your internal VPC topology. While 10.x.x.x addresses are private, knowing your exact subnet structure helps attackers map your network if they breach the perimeter.
- Use strict CIDR blocks (/32) when configuring firewall rules or database access to enforce the principle of least privilege.
- Verify provider-specific reserved IP rules before finalizing your subnet sizes, as Azure, GCP, and AWS all have slight variations in how many IPs they reserve per block.
Testing Instructions
- Validate overlaps using Terraform: 'terraform plan' will often catch overlapping subnets if you use the cidrsubnet() function properly.
- Run 'ip addr show' on Linux to verify the actual CIDR applied to your network interface.
Frequently Asked Questions
What is a CIDR Calculator?
How do I calculate CIDR subnet mask?
How many hosts are in a CIDR block?
How do I split CIDR into subnets?
What is usable address range?
What is /8 CIDR notation?
Can I calculate IPv6 CIDR?
How do I use Terraform cidrsubnet?
How We Keep Your Configs Safe & Valid
Built-in Error Checking
Every file is checked against official rules. We catch missing fields and bad syntax. YAML indentation errors are flagged right away. Kubernetes, Terraform, and Docker specs are all covered. API versions and labels are verified too. You get valid output every time you generate.
100% Private & Local
All tools run in your browser only. Your API keys never leave your machine. We do not use any tracking scripts. No data is sent to any server. Passwords and secrets stay on your device. Crypto operations use the Web Crypto API. Your privacy is fully protected at all times.
Secure Settings by Default
Configs use safe defaults out of the box. Containers run as non-root users. Root filesystems are set to read-only. Dangerous Linux capabilities are dropped. Network policies limit pod-to-pod traffic. TLS 1.3 is enabled for web servers. Security headers are added where needed.
Ready for CI/CD & Git
Output files are ready for your Git repo. Use them with ArgoCD, Flux, or GitHub Actions. Files use clear formatting and comments. Code review is easy for your team. Indentation and key order are consistent. Test in staging before going to production. Every file is clean and well-structured.
Infrastructure as Code
Store configs in Git alongside your code. Terraform modules include typed variables. Backend configs support remote state locking. Outputs work across multiple modules. Ansible playbooks use clear task steps. Chef and Puppet configs are also supported. Every file works with version control tools.
Monitoring & Tracing
Set up Prometheus with auto-discovery rules. Create Grafana dashboards with template variables. Add alerting rules with severity labels. Use OpenTelemetry for trace collection. Forward logs to Loki or Elasticsearch. Connect to Jaeger or Tempo for tracing. Monitor metrics, logs, and traces together.
Container & Docker Safety
Dockerfiles use multi-stage builds for small images. Base images are pinned to exact versions. Dev files are excluded from final images. Health checks are added for orchestrator use. Containers switch to non-root users. Docker Compose uses named volumes and networks. Resource limits are set in deploy configs.
Multiple Output Formats
Export as YAML, JSON, HCL, or TOML. Kubernetes uses YAML with proper separators. Terraform uses HCL with correct escaping. JSON output has consistent indentation. Copy to clipboard with one click. Preview output with syntax highlighting. Line numbers help you review quickly.