/24

Subnet Calculator

Network and broadcast address, subnet and wildcard mask, usable host range and host count for an IPv4 CIDR block, or the range and size of an IPv6 prefix.

Technology & ComputingRuns in your browser

Result…

IP version

CIDR such as 10.0.0.5/16, or an address and mask such as 192.168.1.10 255.255.255.0.

Leave blank when the address already has /24 or a mask. A mask such as 255.255.255.192 or a prefix such as /26.

 

…

How it's calculated

Network = address AND mask; broadcast = network OR wildcard (wildcard = NOT mask)
IPv4 usable hosts = 2^(32 − prefix) − 2 (a /31 has 2, a /32 has 1)
IPv6 addresses in a prefix = 2^(128 − prefix)

An IP prefix splits an address into a network part (the first prefix-length bits) and a host part. Setting the host bits to 0 gives the network address; setting them to 1 gives the last address, which in IPv4 is the broadcast address. In ordinary IPv4 subnets those two are not given to hosts, so a /24 has 256 addresses and 254 usable hosts. RFC 3021 lets a /31 on a point-to-point link use both of its addresses, and a /32 is a single host. IPv6 has no broadcast, and its subnets are usually /64, which hold 2⁶⁴ addresses. Address types follow the IANA special-purpose address registries; the old A, B and C classes no longer decide the mask, but are shown because courses still teach them.

Your numbers, step by step

    About the Subnet calculator

    This subnet calculator works out the details of an IPv4 or IPv6 network from an address and its prefix. For IPv4, type CIDR notation such as 192.168.1.10/24, or an address and a subnet mask, and get the network and broadcast address, the subnet and wildcard masks, the first and last usable host, the number of usable hosts and the address type. It handles /31 point-to-point links (RFC 3021) and /32 single hosts. For IPv6 it gives the network prefix, the first and last address, the exact number of addresses, and the address in full and in the standard short form from RFC 5952. Network engineers, students preparing for certification exams and anyone setting up a router or cloud network can use it. The steps show the address and mask in binary, so you can check the AND and OR yourself.

    How to use it

    1. Choose the “IP version”.
    2. For IPv4, enter the “IPv4 address and prefix”, such as 10.0.5.77/22, or an address followed by a mask.
    3. If the address has no prefix, type the “Subnet mask (if no prefix above)”, such as 255.255.255.192.
    4. For IPv6, enter the “IPv6 address and prefix”, such as 2001:db8::/48; the short :: form is fine.
    5. Read the network, the host range and count, and the binary working in the steps.

    Worked example

    For 10.0.5.77/22 the mask is 22 one-bits, 255.255.252.0, with wildcard 0.0.3.255. The address AND the mask gives the network 10.0.4.0, and the network OR the wildcard gives the broadcast 10.0.7.255. The block holds 2^(32 − 22) = 1,024 addresses, so 1,022 usable hosts, from 10.0.4.1 to 10.0.7.254; it is in the 10.0.0.0/8 private-use range. In IPv6, 2001:db8::/48 runs from 2001:db8:: to 2001:db8:0:ffff:ffff:ffff:ffff:ffff, which is 2⁸⁰ = 1,208,925,819,614,629,174,706,176 addresses, or 65,536 subnets of /64.

    Updated

    Questions people ask

    How do I calculate the number of hosts in a subnet?

    Raise 2 to the number of host bits, 32 minus the prefix, and subtract 2 for the network and broadcast addresses. A /26 has 2⁶ − 2 = 62 usable hosts. The same powers of two give the binary units in the data storage converter.

    How many usable addresses does a /31 have?

    Two. RFC 3021 lets point-to-point links use both addresses of a /31, since such a link needs no broadcast address. A /32 is a single host.

    What is a wildcard mask?

    It is the subnet mask with every bit flipped, so 255.255.255.0 becomes 0.0.0.255. Access lists on some routers use it to say which bits of an address must match.

    Which IPv4 addresses are private?

    RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. The calculator also flags loopback, link-local, carrier-grade NAT and documentation ranges from the IANA special-purpose address registry.

    Why can't I use every address in my cloud subnet?

    Many cloud providers and routers keep a few addresses in each subnet for their own gateway, DNS or future use, on top of the network and broadcast addresses. Check your provider's documentation before planning to the last host.

    More in Technology & Computing