Network Utilities

Subnet Mask Info

Converts CIDR prefix lengths to subnet masks and calculates network capacity. Call `/v1/network/subnet-mask` with a prefix (like 24) to get the dotted decimal mask (255.255.255.0), available host count, and network class. Essential for network configuration in infrastructure automation and MCP-enabled editors like Cursor.

API Endpoint

GET /v1/network/subnet-mask

Code Examples

curl "https://tinyfn.io/v1/network/subnet-mask" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/network/subnet-mask', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/network/subnet-mask',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's network tools:

{
  "mcpServers": {
    "tinyfn-network": {
      "url": "https://tinyfn.io/mcp/network",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I convert CIDR /24 to subnet mask format?

Pass prefix=24 to get 255.255.255.0. The tool converts any valid CIDR notation (8-30) to dotted decimal format with host count calculations.

What information does the subnet mask tool return?

Returns the dotted decimal mask, total hosts, usable hosts (minus network/broadcast), network class, and whether it's a valid subnet for the given prefix length.

Can I use this tool in MCP clients for network automation?

Yes, it works in Cursor, Windsurf, and other MCP clients. Useful for generating network configs, validating CIDR blocks, or calculating IP ranges in infrastructure scripts.

What's the difference between total hosts and usable hosts?

Total hosts is 2^(32-prefix). Usable hosts subtracts 2 for network and broadcast addresses, except /31 and /32 which have special handling for point-to-point links.

Does this work for IPv6 or only IPv4 subnets?

Currently IPv4 only. Handles standard prefixes from /8 to /32, including edge cases like /31 point-to-point and /32 host routes.

Try Subnet Mask Info Now

Get your free API key and start using Subnet Mask Info in seconds.

Get Free API Key