Free CIDR and port API

A small, static, keyless JSON API for network reference data. Look up the mask and host count for any CIDR prefix, or the details of common ports. No key, no rate limit, no sign up.

Endpoints

Every endpoint is a plain static JSON file. Fetch it, cache it, ship it. Because it is served statically, there is nothing to throttle.

EndpointReturns
/api/index.jsonAPI index with version and the full endpoint list.
/api/cidr.jsonAll 33 CIDR prefixes with mask, wildcard, and host counts.
/api/cidr/{n}.jsonOne prefix (0 to 32): its mask, wildcard, total and usable hosts.
/api/ports.jsonThe port reference: number, service, protocol, and security flag.

Example: look up a prefix

fetch("https://subnetkit.dev/api/cidr/24.json")
  .then((r) => r.json())
  .then((data) => {
    // { prefix: 24, mask: "255.255.255.0", usableHosts: 254, ... }
    console.log(data.mask, data.usableHosts);
  });

Example response (ports)

{
  "updated": "2026-07-02",
  "count": 37,
  "ports": [
    { "port": 22, "name": "SSH", "protocol": "TCP", "secure": true },
    { "port": 443, "name": "HTTPS", "protocol": "TCP", "secure": true }
  ]
}

Using it in your own tool

The CIDR endpoint is handy for build-time address planning, and the ports endpoint pairs well with a firewall or scanning script. If you just want to show a calculator on your page without any code, the embeddable widget does it in one line.

Attribution. The API is free for any use. A link back to SubnetKit is appreciated and helps keep it maintained, but it is not required.

Frequently asked questions

Is there a rate limit on the API?

No. Every endpoint is a static JSON file on a CDN, so you can fetch it as often as you like. Caching it on your side is still polite and fast.

Do I need an API key?

No key, no sign up, no auth. The endpoints are plain public files. Fetch them from a browser, a script, or a build step.

Can I use the API in a commercial project?

Yes, freely. A link back to SubnetKit is appreciated and helps keep the data maintained, but it is not required.

How current is the port data?

The port list covers the well-known and commonly-used services. Each response carries an 'updated' date so you know the snapshot you are working with.