[ advertisement ]

IPv4 / CIDR Subnet Calculator

Enter an address with a CIDR prefix or mask to get the network address, broadcast, first and last usable hosts, wildcard and binary representation.

Address

Subnet

Network
192.168.10.64/26
Mask
255.255.255.192
Wildcard
0.0.0.63
Broadcast
192.168.10.127
First host
192.168.10.65
Last host
192.168.10.126
Usable hosts
62
Total addresses
64

Details

Class
C
Type
Privado (RFC 1918)
IP (binary)
11000000.10101000.00001010.01001101
Mask (binary)
11111111.11111111.11111111.11000000
Network (binary)
11000000.10101000.00001010.01000000
IP (hex)
0xC0A80A4D
IP (decimal)
3232238157

Use via API

Calculates the network, broadcast, host range and masks of an IPv4 subnet.

GEThttps://enhanced.dev.br/api/v1/calc/subnet
Query string parameters
QueryTypeDescription
cidr *stringIP with prefix ("10.0.0.1/24") or with mask ("10.0.0.1 255.255.255.0").

Request example

curl "https://enhanced.dev.br/api/v1/calc/subnet?cidr=192.168.10.77%2F26"

Response

{
  "ok": true,
  "data": {
    "ip": "192.168.10.77",
    "prefix": 26,
    "network": "192.168.10.64",
    "mask": "255.255.255.192",
    "wildcard": "0.0.0.63",
    "broadcast": "192.168.10.127",
    "firstHost": "192.168.10.65",
    "lastHost": "192.168.10.126",
    "usableHosts": 62,
    "totalAddresses": 64,
    "addressClass": "C",
    "type": "Privado (RFC 1918)",
    "binary": {
      "ip": "11000000.10101000.00001010.01001101",
      "mask": "11111111.11111111.11111111.11000000"
    }
  },
  "meta": {
    "version": "v1"
  }
}
  • Errors return { ok: false, error: { code, message } } with an HTTP 4xx/5xx status.
  • Free, no API key required. Limited to 120 requests per minute per IP.
  • CORS enabled: call it straight from the browser on any domain.
[ advertisement ]

How to use

  1. Type the IP with a prefix (192.168.1.10/24) or with a mask (192.168.1.10 255.255.255.0).
  2. Or change the prefix with the selector to compare subnet sizes.
  3. Read the network, broadcast, host range and total addresses.
  4. Use the binary view to see where the mask splits network and host bits.

Use cases

  • Planning VPCs and subnets on AWS, Azure or GCP.
  • Writing firewall rules and security groups with CIDR ranges.
  • Sizing local networks, VLANs and DHCP pools.
  • Studying for certifications such as CCNA.

Technical concepts

CIDR notation

The /n suffix says how many leading bits of the address belong to the network. A /24 leaves 8 bits for hosts, or 256 addresses; each bit removed from the prefix doubles the network size.

Network, broadcast and usable hosts

The first address identifies the network and the last is the broadcast, so a typical subnet has 2^(32−n) − 2 usable hosts. The exceptions are /31, used for point-to-point links (RFC 3021) with 2 hosts, and /32, which represents a single host.

Wildcard mask

The wildcard is the bitwise inverse of the mask (0.0.0.255 for a /24) and is used in Cisco ACLs and OSPF configurations.

Private ranges

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is used by ISPs for CGNAT.

Frequently asked questions

How many hosts fit in a /26?

64 addresses in total and 62 usable hosts.

Why does AWS reserve 5 IPs per subnet?

Besides network and broadcast, AWS reserves the VPC router, DNS and one address for future use. A /24 subnet on AWS has 251 usable IPs.

Does the calculator support IPv6?

This version calculates IPv4 only.

Related tools