# CIDR calculator

> Network, broadcast, host range, and membership for IPv4 and IPv6.

Free subnet calculator. Enter an IPv4 or IPv6 CIDR and see the network, mask, broadcast, first and last host, and the address count. Test whether an address is inside, split the block, or merge adjacent networks.

- Page: https://benchline.fabwaseem.com/t/ip-cidr-calculator
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: An IPv4 or IPv6 CIDR, an optional address, a split prefix, and CIDRs to merge.
- Output: Network, mask, host range, membership, split list, and merged CIDRs.
- Keywords: subnet calculator, cidr calculator, ip calculator
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Enter a CIDR.** 192.168.1.0/24 or 2001:db8::/32. Host bits are masked off in the network address.
2. **Test, split, or merge.** Optional: an address to test, a longer prefix, or more CIDRs to aggregate.
3. **Read the range.** The network, mask, broadcast, and host count update as you type.

## Use it from an AI agent

MCP tool name: `calculate_cidr`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/ip-cidr-calculator with the input as the JSON body
This call does not fetch anything. It runs on the arguments you send.

Return the network, broadcast, host range, and host count for an IPv4 or IPv6 CIDR. Optionally test whether an address is inside it, split it, or merge it with other CIDRs.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "cidr": {
      "type": "string",
      "description": "IPv4 or IPv6 CIDR, such as 192.168.1.0/24 or 2001:db8::/32. A dotted mask may follow the address."
    },
    "contains": {
      "description": "Address to test for membership.",
      "type": "string"
    },
    "splitPrefix": {
      "description": "Longer prefix to split into, at most 256 networks.",
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "merge": {
      "description": "Extra CIDRs to aggregate with cidr.",
      "maxItems": 64,
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "cidr"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "calculate_cidr",
    "arguments": {
      "cidr": "example"
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### How are usable hosts counted?

For IPv4 prefixes of /30 and shorter, the network and broadcast addresses are subtracted. /31 and /32 keep every address. IPv6 reports the full address count.

### Can I paste a dotted mask?

Yes. 192.168.1.10 255.255.255.0 is the same block as 192.168.1.10/24.

### Why is a split limited?

A split that would emit more than 256 networks is refused so the page stays readable. Pick a prefix closer to the original.

## Related tools

- [DNS lookup](https://benchline.fabwaseem.com/t/dns-lookup): Query A, AAAA, MX, TXT, CNAME, and CAA over DNS-over-HTTPS.
- [HTTP headers](https://benchline.fabwaseem.com/t/http-headers-checker): Follow redirects and grade the security headers on a public URL.
- [URL encoder and parser](https://benchline.fabwaseem.com/t/url-codec): Encode or decode a URL, then break the query string into parameters.
- [Chmod calculator](https://benchline.fabwaseem.com/t/chmod-calculator): Turn a permission grid into octal and symbolic chmod, and back.
