Supports inline /prefix. e.g. 192.168.1.10/24 or 2001:db8::/48
Dotted mask (IPv4) or /prefix. e.g. 255.255.255.0 or /24 or /64
Advanced: VLSM helper (IPv4)
Enter a parent IPv4 network above and choose equal split or hosts-per-subnet.
Enter an address to see results.
🔍

    🧭 Overview

    This IP / Subnet / CIDR Calculator instantly converts between CIDR notation and dotted subnet masks, and computes the network address, broadcast address (IPv4), first/last usable IP, usable host count, and wildcard mask for ACLs. It supports IPv4 and IPv6, plus a practical VLSM (Variable Length Subnet Masking) helper for planning subnets.

    Typical searches this tool answers: subnet calculator, CIDR calculator, CIDR to subnet mask, wildcard mask calculator, IPv6 prefix calculator, VLSM calculator, how many hosts in /26, what is my network address.

    ⚡ Quick Start

    1. Paste an IP as address/prefix (e.g., 192.168.1.10/24 or 2001:db8::/48) or enter the IP and provide a dotted mask (255.255.255.0) or /prefix in the mask box.
    2. Click Calculate / Update. The result table shows network, broadcast, usable range, wildcard, and host counts.
    3. Open Advanced → VLSM helper to split a parent network into equal subnets or per-subnet host requirements.
    4. Use Copy, Export to TXT, Print/PDF, or Share Link to save or share.

    ⚙️ How This Tool Works

    • IPv4 math: Convert IP to a 32-bit integer. Subnet mask from prefix: (0xFFFFFFFF << (32 − p)) & 0xFFFFFFFF. Network = ip & mask. Broadcast = network | (~mask).
    • Usable range (IPv4): For /0…/30, usable hosts = 2^(32 − p) − 2, first IP = network + 1, last IP = broadcast − 1. Special cases: /31 has 2 usable (point-to-point, no broadcast); /32 has 1 host.
    • Wildcard (IPv4): The ACL wildcard is the bitwise NOT of the mask; e.g., 255.255.255.0 → 0.0.0.255.
    • IPv6: No broadcast/usable concept. We show the prefix start and prefix end by setting host bits to 0/1 using 128-bit arithmetic (BigInt).
    • VLSM (IPv4): For equal splits, we add bits to the parent prefix. For a host list, we pick the smallest prefix that fits each request (largest first), align to block boundaries, and step through the parent space.

    🧮 Subnet Formulas (Reference)

    IPv4 mask from prefix p (0 ≤ p ≤ 32):
      mask = (0xFFFFFFFF << (32 - p)) & 0xFFFFFFFF
    
    Network & broadcast (IPv4):
      network   = ip & mask
      broadcast = network | (~mask)
    
    Wildcard (IPv4 ACL):
      wildcard = (~mask) & 0xFFFFFFFF
    
    Usable host count (IPv4):
      if p ≤ 30: hosts = 2^(32 - p) - 2
      if p = 31: hosts = 2       (point-to-point)
      if p = 32: hosts = 1       (single host)
    
    VLSM: smallest prefix for N hosts (IPv4):
      if N = 1 → /32
      if N = 2 → /31
      else     → p = 32 - ceil(log2(N + 2))   // +2 for net/bcast

    📒 IPv4 CIDR Cheat Sheet

    /pSubnet MaskWildcardBlock Size (IPs)Usable Hosts*
    /00.0.0.0255.255.255.2554,294,967,2964,294,967,294
    /8255.0.0.00.255.255.25516,777,21616,777,214
    /16255.255.0.00.0.255.25565,53665,534
    /24255.255.255.00.0.0.255256254
    /25255.255.255.1280.0.0.127128126
    /26255.255.255.1920.0.0.636462
    /27255.255.255.2240.0.0.313230
    /28255.255.255.2400.0.0.151614
    /29255.255.255.2480.0.0.786
    /30255.255.255.2520.0.0.342
    /31255.255.255.2540.0.0.122 (ptp)
    /32255.255.255.2550.0.0.011

    *Usable hosts follow traditional rules; /31 has 2 usable (RFC 3021), /32 is a single host.

    🧬 IPv6 Prefix Guide (No Broadcast)

    IPv6 uses 128-bit addresses and has no broadcast. Most LANs allocate /64; organizations commonly receive /48 or /56.

    PrefixTypical UseAddress Space
    /32ISP allocation296 addresses
    /48Org/site allocation280 addresses (65,536 × /64)
    /56SMB/site, some ISPs272 addresses (256 × /64)
    /64Single subnet (LAN)264 addresses
    /127Point-to-point2 addresses
    /128Single host1 address

    Special ranges: Link-local fe80::/10, Unique-Local fc00::/7 (commonly fd00::/8), Documentation 2001:db8::/32.

    🧪 Worked Examples

    1) IPv4 with CIDR

    Input: 192.168.1.10/24
    Mask:  255.255.255.0
    Net:   192.168.1.0
    Bcast: 192.168.1.255
    First: 192.168.1.1
    Last:  192.168.1.254
    Hosts: 254
    Wildcard: 0.0.0.255

    2) IPv4 with dotted mask

    Input: 172.16.5.20  Mask: 255.255.255.224 (/27)
    Net:   172.16.5.0
    Bcast: 172.16.5.31
    Usable: 172.16.5.1 – 172.16.5.30 (30 hosts)
    Wildcard: 0.0.0.31

    3) IPv4 /31 point-to-point

    Input: 10.0.0.0/31
    Usable IPs: 10.0.0.0 and 10.0.0.1 (2 usable, no broadcast)

    4) VLSM hosts list

    Parent: 192.168.10.0/24
    Requests (hosts): 60, 30, 10
    
    Assigned:
      60 → 192.168.10.0/26     usable 62
      30 → 192.168.10.64/27    usable 30
      10 → 192.168.10.96/28    usable 14
    Remaining space continues from 192.168.10.112/28 ...

    5) IPv6 prefix preview

    Input: 2001:db8::/48
    Start: 2001:db8::               End: 2001:db8:0:ffff:ffff:ffff:ffff:ffff
    (No broadcast in IPv6)

    🧩 Popular Use Cases

    • Designing VLANs and LAN segments with the right host capacity.
    • Allocating router point-to-point links with /31 (IPv4) or /127 (IPv6).
    • Generating ACL wildcard masks for firewalls and routers.
    • Planning IPv6 addressing at /48, /56, and /64 boundaries.
    • Teaching subnetting, CIDR aggregation, and VLSM to students.

    ❓ FAQs

    What is CIDR notation?
    CIDR (Classless Inter-Domain Routing) expresses a subnet as address/prefix, where prefix is the number of network bits. Example: 192.168.1.10/24 means a 24-bit mask 255.255.255.0.
    How do I convert CIDR to subnet mask?
    Use the table below or the calculator. Example: /26255.255.255.192. The wildcard is 0.0.0.63.
    What is a wildcard mask and why is it used?
    A wildcard mask is the bitwise NOT of the subnet mask. It’s used by some vendors (e.g., Cisco) in ACLs to match IP ranges. Example: permit an entire /24 → 10.1.2.0 0.0.0.255.
    Why do /31 and /32 behave differently?
    /31 is for point-to-point links (RFC 3021) and has 2 usable addresses with no concept of a broadcast. /32 is a single host route (one IP).
    Does IPv6 have broadcast, network, or usable addresses?
    No. IPv6 has no broadcast. The calculator shows the start and end of the prefix; addressing practices rely on /64 for subnets, link-local fe80::/10, and multicast.
    How do I choose a prefix for N hosts?
    For IPv4, pick the smallest prefix with enough usable addresses: p = 32 − ceil(log2(N + 2)), except N=1 → /32, N=2 → /31.
    What are private, loopback, link-local, and CGNAT ranges?
    • Private (RFC1918): 10/8, 172.16/12, 192.168/16
    • Loopback: 127/8
    • Link-local (APIPA): 169.254/16
    • CGNAT: 100.64/10
    • Documentation: 192.0.2/24, 198.51.100/24, 203.0.113/24
    What is supernetting / aggregation?
    Combining adjacent subnets into a larger prefix (e.g., two /25 nets combine into one /24) if they are contiguous and aligned on the relevant boundary.
    Why is my dotted mask “invalid (non-contiguous)”?
    Valid masks have all 1-bits first and all 0-bits after, with no 0→1 transitions. Example of invalid mask: 255.255.0.255.
    How many subnets do I get if I split a /24 into /27s?
    Each /27 has 32 IPs. A /24 has 256 IPs → 256 / 32 = 8 subnets.
    How do I find “the next network” after mine?
    “Next” network = current_network + block_size, where block_size = 2^(32 − p) for IPv4.
    Should I use /127 on IPv6 point-to-point links?
    Yes, it’s common to use /127 for IPv6 P2P to avoid ND issues and reduce attack surface. Alternatives like /64 on P2P still work but are less tight.
    What are common multicast and reserved IPv4 ranges?
    Multicast: 224/4, Reserved/broadcast legacy behaviors around 0/8 and 255.255.255.255. The calculator flags the common special ranges but still computes the math.
    Is this calculator accurate for very large or very small prefixes?
    Yes. All IPv4 math uses 32-bit integer operations; IPv6 uses 128-bit BigInt arithmetic to avoid precision loss.
    Can I share my calculation?
    Click Share Link to copy a URL with your inputs encoded. Anyone opening it will see the same results.

    🧯 Troubleshooting

    • “Invalid IPv4 address” — check octets are 0–255 with no leading/trailing spaces.
    • “Invalid dotted subnet mask” — mask must be contiguous 1-bits (e.g., 255.255.0.255 is invalid).
    • Overlapping VLSM outputs — ensure the parent prefix is large enough; the tool allocates largest requests first and aligns to block boundaries.
    • IPv6 needs a prefix — include /64, /56, etc. Dotted masks don’t apply to IPv6.

    📚 Glossary

    • CIDR — Classless Inter-Domain Routing; address/prefix notation.
    • Subnet mask — a dotted decimal mask for IPv4 (e.g., 255.255.255.0).
    • Wildcard mask — inverse of subnet mask, used by ACLs.
    • Network address — all host bits zero.
    • Broadcast address (IPv4) — all host bits one (not used for /31).
    • VLSM — Variable Length Subnet Masking; allocating different-sized subnets from one parent.

    📚 Data Sources & Attribution

    • RFC 4632 — Classless Inter-Domain Routing (CIDR) for IPv4
    • RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links
    • RFC 4291 — IPv6 Addressing Architecture
    • RFC 4193 — Unique Local IPv6 Unicast Addresses
    • RFC 6890 — Special-Purpose Address Registries
    • RFC 1918 — Address Allocation for Private Internets