Converts subnet masks like 255.255.255.0 to CIDR notation (/24). Access via MCP in Cursor or Windsurf for network calculations, or hit the REST endpoint at /v1/ip/netmask-to-cidr. Essential for network automation scripts and IP configuration tools. Returns precise prefix lengths without guesswork.
curl "https://tinyfn.io/v1/ip/netmask-to-cidr" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/ip/netmask-to-cidr', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/ip/netmask-to-cidr',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's ip address tools:
{
"mcpServers": {
"tinyfn-ip": {
"url": "https://tinyfn.io/mcp/ip",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Pass the netmask as a parameter - it returns /20 since 255.255.240.0 represents 20 consecutive 1-bits in binary.
The tool validates that subnet masks have consecutive 1-bits followed by consecutive 0-bits, rejecting invalid patterns that aren't proper netmasks.
Yes, call it directly in Cursor or Claude Code when writing network automation scripts - no need to memorize CIDR conversions or use external calculators.
Supports dotted decimal notation (255.255.255.0) and returns CIDR prefixes from /0 to /32 for IPv4 networks.
This specifically converts subnet masks to prefix lengths, while IP-to-CIDR tools typically convert IP addresses with their associated network masks to CIDR blocks.
Get your free API key and start using Netmask To Cidr in seconds.
Get Free API Key