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.
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)
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"
}
}
}
}
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.
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.
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.
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.
Currently IPv4 only. Handles standard prefixes from /8 to /32, including edge cases like /31 point-to-point and /32 host routes.
Get your free API key and start using Subnet Mask Info in seconds.
Get Free API Key