---
title: "Calculate IPv4 subnet details from CIDR notation. Parses a CIDR block (e.g. 192.168.1.0/24) and returns the network address, broadcast address, subnet mask, wildcard mask, first and last usable host addresses, total and usable host counts, prefix length, and classful IP class (A/B/C/D/E). Essential for homelab network planning, VLAN segmentation, firewall rule design, and understanding address space allocation. Handles special cases for /31 point-to-point links (RFC 3021) and /32 host routes."
method: POST
path: "/api/subnet_calculator"
tags: ["homelab"]
---

# Calculate IPv4 subnet details from CIDR notation. Parses a CIDR block (e.g. 192.168.1.0/24) and returns the network address, broadcast address, subnet mask, wildcard mask, first and last usable host addresses, total and usable host counts, prefix length, and classful IP class (A/B/C/D/E). Essential for homelab network planning, VLAN segmentation, firewall rule design, and understanding address space allocation. Handles special cases for /31 point-to-point links (RFC 3021) and /32 host routes.

`POST /api/subnet_calculator`

## Request

- Base URL: `https://calc.engineer`
- URL: `https://calc.engineer/api/subnet_calculator`
- Auth: none declared

## Request body

- object
  - `cidr` string, required: IPv4 address in CIDR notation, e.g. 192.168.1.0/24

## Response `200`

Computed result for subnet_calculator

- object
  - `result` object, required
    - `network_address` string, required: Network address of the subnet
    - `broadcast_address` string, required: Broadcast address of the subnet
    - `subnet_mask` string, required: Subnet mask in dotted decimal notation, e.g. 255.255.255.0
    - `wildcard_mask` string, required: Wildcard (inverse) mask, e.g. 0.0.0.255
    - `first_usable` string, required: First usable host address in the subnet
    - `last_usable` string, required: Last usable host address in the subnet
    - `total_hosts` number, required: Total number of addresses in the subnet including network and broadcast
    - `usable_hosts` number, required: Number of usable host addresses (excluding network and broadcast)
    - `prefix_length` number, required: CIDR prefix length, e.g. 24
    - `ip_class` string, required: Classful IP address class: A, B, C, D (multicast), or E (reserved)
  - `tool` string, required
  - `version` string, required
  - `computed_at` string, date-time, required
  - `chain` object, required
    - `feeds` unknown[]
      - unknown
    - `accepts_from` unknown[]
      - unknown

## Other responses

- `400`: Validation error or invalid JSON
- `404`: Tool not found

---

[API](https://skmtc.dev/calc/apis/calc-engineer-api.md) · [All operations](https://skmtc.dev/calc/apis/calc-engineer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/calc/apis/calc-engineer-api/revisions/8830480ec488?raw)
