{
    "name": "IP Subnet Calculator",
    "url": "https://calculators.geekmidst.com/calculators/ip-subnet-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/ip-subnet-calculator.md",
    "category": "IT, networking & security",
    "description": "Enter an IPv4 address and prefix length (CIDR) to get the network and broadcast addresses, subnet mask, wildcard mask and usable host range.",
    "summary": "An IPv4 prefix such as /24 says how many leading bits identify the network. The rest identify hosts, which fixes the network address, the broadcast address and how many devices fit.",
    "also_called": [
        "CIDR calculator",
        "Subnet mask calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "ip",
            "label": "IPv4 address",
            "type": "text",
            "default": "192.168.1.10"
        },
        {
            "name": "prefix",
            "label": "Prefix length (CIDR)",
            "type": "number",
            "default": "24",
            "unit": "bits"
        }
    ],
    "outputs": [
        {
            "key": "cidr",
            "label": "Network (CIDR)",
            "format": "text"
        },
        {
            "key": "network",
            "label": "Network address",
            "format": "text"
        },
        {
            "key": "broadcast",
            "label": "Broadcast address",
            "format": "text"
        },
        {
            "key": "first_host",
            "label": "First usable host",
            "format": "text"
        },
        {
            "key": "last_host",
            "label": "Last usable host",
            "format": "text"
        },
        {
            "key": "usable_hosts",
            "label": "Usable hosts",
            "format": "integer"
        },
        {
            "key": "total_addresses",
            "label": "Total addresses",
            "format": "integer"
        },
        {
            "key": "netmask",
            "label": "Subnet mask",
            "format": "text"
        },
        {
            "key": "wildcard",
            "label": "Wildcard mask",
            "format": "text"
        },
        {
            "key": "mask_binary",
            "label": "Mask in binary",
            "format": "text"
        },
        {
            "key": "address_type",
            "label": "Address type",
            "format": "text"
        }
    ],
    "formula": {
        "text": "Block size = 2^(32 − prefix);  Network = ⌊address ÷ block⌋ × block;  Broadcast = Network + block − 1;  Usable hosts = block − 2 (2 for /31, 1 for /32)",
        "variables": {
            "prefix": "number of network bits (0–32)",
            "block": "number of addresses in the subnet"
        }
    },
    "worked_example": {
        "inputs": {
            "ip": "192.168.1.10",
            "prefix": "24"
        },
        "steps": [
            "A /24 leaves 32 − 24 = 8 host bits, so the block is 2⁸ = 256 addresses.",
            "The network address keeps the first three octets and sets the last to 0: 192.168.1.0.",
            "The broadcast address sets all host bits to 1: 192.168.1.255.",
            "Usable hosts are 256 − 2 = 254, from 192.168.1.1 to 192.168.1.254."
        ],
        "result": "192.168.1.10/24 is in network 192.168.1.0/24, with 254 usable addresses from .1 to .254 and mask 255.255.255.0."
    },
    "interpretation": "Devices on the same subnet talk directly; anything outside goes through a router. Pick the smallest subnet that leaves room to grow: a /26 holds 62 hosts, a /25 126 and a /24 254.",
    "assumptions": [
        "IPv4 only.",
        "The network and broadcast addresses are not assigned to hosts, except in /31 point-to-point links (RFC 3021) and single-host /32 routes."
    ],
    "limitations": [
        "IPv6 subnets are not calculated.",
        "Address type labels cover the main special ranges (private, loopback, link-local, CGNAT, multicast), not every reserved block."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "What is a wildcard mask?",
            "answer": "The inverse of the subnet mask (0.0.0.255 for /24). Cisco access lists and OSPF use it to say which bits may vary."
        },
        {
            "question": "Why are two addresses not usable?",
            "answer": "In a normal subnet the all-zeros host address names the network itself and the all-ones address is the broadcast address."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Password Generator",
            "url": "https://calculators.geekmidst.com/calculators/password-generator"
        },
        {
            "name": "Conversion Calculator",
            "url": "https://calculators.geekmidst.com/calculators/conversion-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}