ToolGrid — Product & Engineering
Leads product strategy, technical architecture, and implementation of the core platform that powers ToolGrid calculators.
AI Credits & Points are in development.
Learn moreLoading...
Preparing your workspace
Calculate CIDR (Classless Inter-Domain Routing) network information including network address, broadcast address, usable host count, subnet mask, provides IP range visualization, lists available IPs, and supports IPv4/IPv6 conversions for network planning.
Note: AI can make mistakes, so please double-check it.
No subnets defined. Add subnets manually or use AI Planner.
Common questions about this tool
Paste your cidr calculator code into the formatter, and it automatically applies proper indentation, spacing, and organization. The tool improves code readability while maintaining functionality.
Yes, the cidr calculator beautifies code by adding consistent formatting, proper indentation, and organizing structure. This makes code easier to read, debug, and maintain without changing functionality.
No, formatting only changes whitespace and organization. It doesn't alter code logic, syntax, or behavior, so your cidr calculator code works exactly the same after formatting.
Yes, the formatter offers customization options including indentation style, line length, and formatting preferences to match your project's coding standards and team preferences.
Paste minified code into the formatter, and it automatically adds proper indentation and line breaks to make the code readable again. This is useful for debugging or reviewing compressed code.
Enter your base network block in CIDR format (for example `10.0.0.0/16`) and add one or more subnet requirements with the number of hosts you need; the tool parses the CIDR, computes total capacity, and then walks allocations in order. For each requirement it uses `getBitsForHosts` to find the smallest prefix that fits the requested hosts, aligns the subnet on a valid boundary, and assigns start, end, gateway, and broadcast addresses. The resulting list shows each child CIDR, usable hosts, and whether the allocation still fits inside the parent block.
As you add subnet requirements the calculator sums the size of each allocated range and compares it to the total IP capacity of the base CIDR. The capacity bar and Plan Overview panel show total, used, and available addresses, and the `isOverflowing` flag turns the used count red if you exceed the parent network. Individual allocations also track their offset and validity so you can see when a particular subnet would spill beyond the original block.
Each subnet requirement lets you assign a name and host count, and the planner turns those into concrete CIDR ranges with aligned network and broadcast boundaries. Names like “Web”, “DB”, or team labels are preserved in the output, and you can toggle a details view to see per-subnet masks, usable hosts, and address ranges. There is also an optional AI Planner that can propose a set of subnet requirements from a high-level description, but the final math is still done by the deterministic `network` utility functions.
The implementation is built around 32‑bit arithmetic and assumes IPv4 addresses, using helpers such as `ipToLong`, `longToIp`, and `/0–/32` prefix validation. It will reject inputs that do not match dotted‑quad IPv4 format and cannot parse or model IPv6 networks. For IPv6 planning you would need a dedicated tool that understands 128‑bit addressing.
Once you have a valid base CIDR and one or more allocations, you can use the Export JSON button in the Plan Overview section to download a JSON file that includes the base block, all subnet allocations, and a timestamp. There is also a Print Config button that triggers the browser’s print dialog so you can capture the current layout as a PDF or paper reference. Both features work entirely in the browser and use the same `NetworkPlan` structure that powers the on-screen view.
Verified content & sources
This tool's content and its supporting explanations have been created and reviewed by subject-matter experts. Calculations and logic are based on established research sources.
Scope: interactive tool, explanatory content, and related articles.
ToolGrid — Product & Engineering
Leads product strategy, technical architecture, and implementation of the core platform that powers ToolGrid calculators.
ToolGrid — Research & Content
Conducts research, designs calculation methodologies, and produces explanatory content to ensure accurate, practical, and trustworthy tool outputs.
Based on 1 research source:
Learn what this tool does, when to use it, and how it fits into your workflow.
This tool helps you split a single IP address block into smaller subnets. It works like a free online CIDR subnet calculator for IPv4 where you enter one base block in CIDR form (for example 10.0.0.0/16) and add one or more subnet requirements by saying how many hosts each subnet must support. The tool then computes each subnet’s CIDR, network address, first and last usable IP, broadcast address, gateway, and host counts, so it behaves as an IP subnet calculator for subnet planning and address allocation that also shows whether the subnets fit inside the base block and lets you export the plan or use an optional AI step to suggest subnets from a short description.
Planning subnets by hand is error-prone. You must align each subnet to valid boundaries, reserve the network and broadcast addresses, and avoid overlaps. Mistakes lead to wrong configs or wasted space, which is why many people look for a CIDR calculator online to calculate subnets from a CIDR block and quickly see network, broadcast, and usable host ranges. This tool does the alignment and math for you so you get valid subnets, a clear view of how much of the block is used, and a practical subnet planning calculator that supports variable length subnetting within a single parent network.
The tool is for anyone who plans or manages IPv4 networks: developers, sysadmins, and network engineers who need a browser-based CIDR notation subnet calculator instead of doing binary math by hand. You can use it with basic knowledge of IP addresses and CIDR; it acts as a simple online tool to calculate subnet masks, IP ranges, and host counts from a CIDR prefix. Understanding what a subnet mask and a gateway are helps, but the tool explains the main outputs well enough for learners who are just starting with subnetting and VLSM planning.
CIDR stands for Classless Inter-Domain Routing. A CIDR block is written as an IP address followed by a slash and a number, for example 192.168.1.0/24. The number is the prefix length: how many bits are fixed for the network part. The rest of the bits identify hosts inside that network. A /24 block has 2 to the power of (32 minus 24) addresses, that is 256. Two of them are reserved: the first is the network address and the last is the broadcast address. So you have 254 usable host addresses in a /24. A related operation involves calculating aspect ratios as part of a similar workflow.
When you split a large block into subnets, each subnet must start at a valid boundary. The size of each subnet must be a power of two. The tool takes your base block and a list of “how many hosts per subnet.” For each requirement it finds the smallest subnet that fits that many hosts (plus the two reserved addresses), places it at the next free boundary inside the base block, and shows you the resulting CIDR, IP range, broadcast, and gateway. Subnets are placed one after another so they do not overlap.
Doing this by hand means a lot of binary or decimal math and easy mistakes. The tool does the math and keeps everything aligned. It only works with IPv4. It does not convert or plan IPv6.
Planning a small office or VPC. You have one block (e.g. 10.0.0.0/16) and need separate subnets for web servers, app servers, and databases. You add three subnets with the right host counts, name them, and read off the CIDR and gateway for each. You then use those values in your router or cloud console. For adjacent tasks, calculating business days addresses a complementary step.
Checking if a plan fits. You already have a list of subnet sizes. You enter your base CIDR and add one requirement per subnet with the desired host count. The tool shows whether all subnets fit and how much space is left. If it overflows you reduce host counts or use a larger base block.
Documenting an allocation. After you get a plan you export the JSON or print the page. You keep the file or printout so your team knows which CIDR and gateway belong to which subnet.
Getting a first draft with AI. You are not sure how to size subnets. You open the AI Planner, type a short description of your tiers or environments, and click generate. The tool fills in subnet names and host counts. You can then adjust numbers or names and see the updated plan. When working with related formats, calculating subnet masks can be a useful part of the process.
Teaching or learning subnetting. You change the base CIDR and add or remove subnets and watch how the CIDRs, ranges, and capacity bar update. The optional details view shows start IP, end IP, broadcast, and gateway so you can see how the math works in practice.
The tool works only with IPv4. It converts each IP to a 32-bit number so it can do arithmetic. The base CIDR is parsed into a network address and a size. The network address is the IP with all host bits set to zero (using the prefix length). The size is two to the power of (32 minus the prefix length). For example /24 gives size 256.
For each subnet requirement the tool finds the smallest prefix length that can hold that many hosts plus two (network and broadcast). For example 100 hosts need 102 addresses, so the next power of two is 128, which is 2^7, so the prefix is 32 minus 7 = 25. The subnet is a /25. The tool then places that subnet at the next free address in the base block, aligned so the subnet starts at a multiple of its size. Each following subnet starts right after the previous one. In some workflows, checking your IP address is a relevant follow-up operation.
Inside each subnet the first address is the network address, the last is the broadcast, and the rest are usable. The tool shows the first usable IP as the gateway (a common choice). Usable host count is the subnet size minus two. Total capacity of the plan is the size of the base block. Used capacity is the sum of all subnet sizes. If used is greater than total, the plan is marked as overflowing.
| Prefix | Subnet size (total IPs) | Usable hosts (size minus 2) |
|---|---|---|
| /24 | 256 | 254 |
| /25 | 128 | 126 |
| /26 | 64 | 62 |
| /27 | 32 | 30 |
| /28 | 16 | 14 |
| /29 | 8 | 6 |
| /30 | 4 | 2 |
Larger prefixes (e.g. /16) mean larger subnets (e.g. /16 is 65536 IPs, 65534 usable). The tool picks the prefix from the host count you ask for; the table above shows common sizes.
Only IPv4 is supported. Do not enter IPv6 addresses or prefixes; they will be rejected or give wrong results. For related processing needs, looking up IP addresses handles a complementary task.
Enter the base CIDR in the form “x.x.x.x/n” with no spaces. The address must be four numbers between 0 and 255 separated by dots. The prefix must be between 0 and 32. Leading zeros in an octet (e.g. 10.00.0.0) are not accepted.
Host count is the number of hosts you need in that subnet. The tool reserves the network and broadcast addresses and chooses a subnet big enough to fit the rest. If you need 50 hosts you get a subnet that can hold at least 52 addresses (50 plus 2 reserved), so a /26 (64 addresses, 62 usable) is chosen.
There is a maximum number of subnets per plan and a maximum host count per subnet. If you hit the subnet limit you cannot add more until you remove one. Large host counts are clamped so the tool stays responsive.
The AI Planner is optional and depends on a remote service. If it fails you see an error; your manually entered subnets are unchanged. You can always add and edit subnets without using the AI.
Export saves the current plan and requirements plus a timestamp. It does not include passwords or secrets. Keep the JSON file in a safe place if you use it for real network config.
Subnets are allocated in the order you list them. If you need a specific order (e.g. a DMZ first), add the subnets in that order. You can remove and re-add to change the order.
Articles and guides to get more from this tool
Computer networks are built on math. Every time you connect a device to the internet, you are assigned an IP address. But that address isn't…
Read full articleSummary: Calculate CIDR (Classless Inter-Domain Routing) network information including network address, broadcast address, usable host count, subnet mask, provides IP range visualization, lists available IPs, and supports IPv4/IPv6 conversions for network planning.