Using NetworkCalc's Free APIs

NetworkCalc - July 11, 2022

Cover image for article: Using NetworkCalc's Free APIs.
local_offer APIs
local_offer Subnets
local_offer Domain Management
local_offer Security
A straightforward guide for making the most out of NetworkCalc's free APIs.

Getting started

To use the free APIs, you need to know the base URL for the NetworkCalc APIs. All API calls start with the base URL If a specific endpoint is given (example: /ip), it is added onto the end of the base url (example:

The following free APIs are available for you to use. Click one of the links below to be taken to the API documentation.

Free public APIs

All NetworkCalc free public APIs use the the same base URL:

Below are the different API endpoints that are available for free and links to their documentation pages.

Resource API Endpoints Documentation
Subnet Calculator /ip/{subnet} Subnet API Documentation
Binary Converter /binary/{number} Binary Converter API Documentation
Security Tools /security/certificate/{hostname} Security Tools API Documentation
DNS Tools /dns/lookup/{hostname} or /dns/whois/{hostname} or /dns/spf/{hostname} DNS Tools API Documentation
Encoder /encoder/{value} Encoder API Documentation

Making API calls

You can use many different tools to make API calls. We'll look at how to make an API call using a few different tools below.

The examples below show how to make an API call to NetworkCalc's free public APIs to find out the subnet mask for the IP address network

Using cURL

cURL is built into many terminals, including Bash and Command Prompt. To make an API call using cURL, simply open up your terminal application and execute the following command:


The response should look something like the one below. As you can see, the subnet mask is shown as

{ "status": "OK", "meta": { "permalink": "", "next_address": "" }, "address": { "cidr_notation": "", "subnet_bits": 27, "subnet_mask": "", "wildcard_mask": "", "network_address": "", "broadcast_address": "", "assignable_hosts": 30, "first_assignable_host": "", "last_assignable_host": "" } }

Using Python

You can easily make API calls using the requests module in Python. You must install the module first using pip or any other Python package manager:

pip install requests

Once you have installed the requests module in Python, you can make API calls, like in the example below:

import requests response = requests.get("") print(response.json())

The response you get back will be a JSON object:

{ "status": "OK", "meta": { "permalink": "", "next_address": "" }, "address": { "cidr_notation": "", "subnet_bits": 27, "subnet_mask": "", "wildcard_mask": "", "network_address": "", "broadcast_address": "", "assignable_hosts": 30, "first_assignable_host": "", "last_assignable_host": "" } }

Using PowerShell

PowerShell is a powerful system administrator tool available by default on the Microsoft Windows operating system. You can make API calls using PowerShell by using the Invoke-WebRequest cmdlet, as shown in the example below.


The response will contain multiple attributes. The response body you receive from NetworkCalc will be under the Content attribute:

StatusCode : 200 StatusDescription : OK Content : {"status":"OK","meta":{"permalink":"","next_a ddress":""},"address":{"cidr_notation":"","s ub... RawContent : HTTP/1.1 200 OK Transfer-Encoding: chunked Connection: keep-alive Strict-Transport-Security: max-age=31536000; preload; X-Content-Type-Options: nosniff Access-Control-Allow-Origin: * Vary: Accep... Forms : {} Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Strict-Transport-Security, max-age=31536000; preload;], [X-Content-Type-Options, nosniff]...} Images : {} InputFields : {} Links : {} ParsedHtml : mshtml.HTMLDocumentClass RawContentLength : 426

You can simplify this command by calling Invoke-WebRequest and selecting the Content attribute directly, as follows:


You may want to work with the data in a format other than JSON. PowerShell has a utility for converting a JSON object to a table, which is easier to work with in PowerShell. To do this, invoke your API call and pipe the results into the ConvertFrom-JSON cmdlet, as shown below:

(Invoke-WebRequest | ConvertFrom-JSON

You can further select attributes to work with until you get exactly what you are looking for. The command below:

((Invoke-WebRequest | ConvertFrom-JSON).address

produces these results:

cidr_notation : subnet_bits : 27 subnet_mask : wildcard_mask : network_address : broadcast_address : assignable_hosts : 30 first_assignable_host : last_assignable_host :

Putting it all together

The NetworkCalc APIs provide a free and easy way to find out the details of your subnets so you can build, manage, and monitor your networks. They also provide useful utilities for checking DNS, security certificates, and performing binary conversions or Base64 encodings.

For details on each of the NetworkCalc APIs and their capabilities, it is recommended to review the API documentation.

Subscribe for more articles like this.