BYTETOOLS

NetworkCalc API

Calculate subnet masks, network and broadcast addresses and host ranges over HTTP, plus DNS lookups, with no API key. Verified example and full field breakdown.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the NetworkCalc API?

NetworkCalc exposes its network tools as a free JSON API. `GET https://networkcalc.com/api/ip/10.0.0.1/24` returns the subnet mask, wildcard mask, network and broadcast addresses and the assignable host range. No API key is required, and a DNS lookup endpoint is available on the same host.

Subnet maths is the sort of thing everyone can do on paper and nobody wants to re-implement correctly. NetworkCalc turns it into a URL: put an address and a prefix length in the path, get back every derived value as JSON. Because the calculation is deterministic, responses cache indefinitely, which makes this one of the few APIs you can safely put behind an aggressive CDN rule.

The response includes a `meta.next_address` link pointing at the following host in the range, which is an unusually thoughtful touch for iterating through a subnet without doing pointer arithmetic yourself. Note that `assignable_hosts` already excludes the network and broadcast addresses, so a /24 reports 254 rather than 256. If you are comparing against your own implementation, that off-by-two is where the mismatch usually is.

Quick facts

Base URL
https://networkcalc.com/api
Authentication
No key or account. The API mirrors the free web tools on the same domain.
Rate limit
Not published. Results are fully deterministic, so cache them and you will never need many requests.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the NetworkCalc API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Calculate the subnet for 10.0.0.1/24

GET https://networkcalc.com/api/ip/10.0.0.1/24

curl
curl 'https://networkcalc.com/api/ip/10.0.0.1/24'
JavaScript (fetch)
const res = await fetch("https://networkcalc.com/api/ip/10.0.0.1/24");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://networkcalc.com/api/ip/10.0.0.1/24", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "status": "OK",
  "meta": {
    "permalink": "https://networkcalc.com/subnet-calculator/10.0.0.1/24",
    "next_address": "https://networkcalc.com/api/ip/10.0.0.2/24"
  },
  "address": {
    "cidr_notation": "10.0.0.1/24",
    "subnet_bits": 24,
    "subnet_mask": "255.255.255.0",
    "wildcard_mask": "0.0.0.255",
    "network_address": "10.0.0.0",
    "broadcast_address": "10.0.0.255",
    "assignable_hosts": 254,
    "first_assignable_host": "10.0.0.1",
    "last_assignable_host": "10.0.0.254"
  }
}

Parameters

ParameterTypeRequiredDescription
{ip}/{prefix}pathRequiredIPv4 address and CIDR prefix length as path segments. 10.0.0.1/24
/api/dns/lookup/{host}pathOptionalAlternative endpoint returning A, AAAA, CNAME, MX, NS and TXT records for a hostname. github.com
/api/binary/{bits}pathOptionalBinary conversion endpoint on the same host. It takes a binary string, not a decimal value. 11111111

Response fields

statusstring
`OK` on success. Check this before reading `address`, because errors still return HTTP 200 in some cases.
address.cidr_notationstring
The input echoed back in canonical form, useful for confirming the API parsed what you meant.
address.subnet_mask / wildcard_maskstring
Dotted-quad mask and its inverse. The wildcard mask is what you need for ACLs on Cisco-style equipment.
address.network_address / broadcast_addressstring
First and last address of the block, neither of which is assignable to a host.
address.assignable_hostsinteger
Usable host count, already excluding network and broadcast. A /24 returns 254.
address.first_assignable_host / last_assignable_hoststring
Bounds of the usable range, ready to paste into a DHCP pool definition.
meta.next_addressstring
A prepared API URL for the next address in the block, so you can walk a range without building URLs yourself.

What you can build with the NetworkCalc API

  • Validate a subnet plan in a provisioning script before creating cloud networks
  • Generate DHCP pool boundaries automatically from a CIDR block
  • Add a subnet calculator to an internal admin tool without writing bit maths
  • Resolve DNS records from a script without depending on the local resolver
  • Teach subnetting with a live endpoint students can query from any language

Common errors and how to fix them

status not OK

Malformed address or an out-of-range prefix length.

Fix: Send a plain dotted-quad address and a prefix between 0 and 32; the API does not accept a dotted-decimal mask in the path.

404

The path shape is wrong.

Fix: The prefix is a separate path segment: `/api/ip/10.0.0.1/24`, not `/api/ip/10.0.0.1%2F24`.

Unexpected host count

You compared against 2^(32-prefix) without subtracting the network and broadcast addresses.

Fix: `assignable_hosts` is already the usable count. For /31 and /32 the conventional arithmetic does not apply at all.

NetworkCalc API — frequently asked questions

Is the NetworkCalc API free?

Yes, with no key and no account. It is the API behind the site's own free calculators.

Does it support IPv6?

The site's tools cover IPv6, but the response shape differs from the IPv4 subnet endpoint documented here. Check the API docs before assuming field parity.

Why does a /24 report 254 hosts and not 256?

The network address and the broadcast address cannot be assigned to a host, so they are excluded. That is standard practice and matches what your router will accept.

Can I use it from browser JavaScript?

Yes. The API returns a permissive CORS header, so a direct fetch from front-end code works without a proxy.

Tools that pair with this API

NetworkCalc is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.