Skip to content
FindTool

    Subnet Calculator

    Work out network, broadcast, host range, masks and splits for any IPv4 or IPv6 CIDR.

    Subnet Calculator tool

    Accepts 10.0.0.0/8, 10.0.0.0 255.0.0.0, 2001:db8::/32, or a bare address.

    Try a common range

    What this tool does

    Type a range such as 192.168.1.130/24 and this page works out the network and broadcast addresses, the first and last host you can actually assign, how many of them there are, the subnet mask in every notation, and which reserved block the range belongs to. It handles IPv4 and IPv6 in the same field.

    Below the table you can check whether a particular address falls inside the range, and split the range into equal subnets — the two things people usually open a calculator for after the first answer.

    Common uses

    • Carving a VPC or VNet address space into per-subnet blocks without overlapping.
    • Checking whether an address a firewall logged is inside the range a rule was meant to cover.
    • Converting between a prefix length and a dotted mask when a device only accepts one.
    • Producing a wildcard mask for a Cisco ACL or an OSPF network statement, which are the inverse of a subnet mask.
    • Sizing a subnet before you request it — deciding between a /26 and a /27.

    A short example

    Input   192.168.1.130/24
    
    Network       192.168.1.0
    First host    192.168.1.1
    Last host     192.168.1.254
    Broadcast     192.168.1.255
    Mask          255.255.255.0
    Wildcard      0.0.0.255
    Usable hosts  254

    Note that the address you typed is not the network address. A /24 has 24 network bits, so the final octet is host space and gets masked off. 192.168.1.130 is one host inside the range, not the range itself.

    Why a /24 has 254 hosts and not 256

    Two addresses in every IPv4 subnet are unusable. The all-zeros host address is the network itself and the all-ones address is the directed broadcast, so a block of 2n addresses gives 2n − 2 hosts. That is why a /30 — four addresses — is the smallest subnet that will carry an ordinary router link, and it wastes half of itself doing it.

    There are two exceptions, and this tool applies both. A /31 is a point-to-point link under RFC 3021: with only two addresses there is no room for a network and a broadcast, so both addresses are usable and the subtraction is skipped. A /32 is a single host — a loopback interface, a host route, a firewall rule for one machine.

    IPv6 has no broadcast address at all, so none of this applies. Every address in an IPv6 prefix is usable, and the answer for a /64 is 18,446,744,073,709,551,616 — which is also why this page does the arithmetic in arbitrary-precision integers. JavaScript numbers lose integer accuracy above 253, so a calculator using them silently returns a rounded host count for anything shorter than a /75.

    Worth knowing

    A subnet mask must be a contiguous run of 1 bits followed by 0 bits — 255.255.255.0 is valid, 255.0.255.0 is not, and this tool rejects the second rather than quietly reinterpreting it. Addresses with a leading zero in an octet are also rejected: 192.168.01.1 is read as decimal by some tools and as octal by others, which makes it genuinely ambiguous rather than merely untidy. Written as 192.168.1.1 it means one thing everywhere.

    Finally, the private ranges are a convention, not a property of the numbers. RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16; routers on the public internet drop traffic for them, but nothing stops you using public space internally, and plenty of networks have painfully discovered they did.

    Frequently asked questions

    How many hosts fit in a /26?

    Sixty-two. A /26 leaves six host bits, so the block holds 26 = 64 addresses, and the all-zeros and all-ones addresses are reserved for the network identifier and the directed broadcast. The general form is 2(32 − prefix) − 2. The subtraction stops applying at the two ends: a /31 carries two usable addresses under RFC 3021 because a point-to-point link needs no broadcast, and a /32 is one host.

    What is a wildcard mask and why is it inverted?

    It is the bitwise complement of the subnet mask, so a /24 whose mask is 255.255.255.0 has the wildcard 0.0.0.255. Cisco IOS access lists and OSPF network statements take this form: a 0 bit means the bit must match and a 1 bit means ignore it. Because the bits are only ever tested individually, a wildcard mask is allowed to be non-contiguous — 0.0.0.254 matches every even final octet — which is something no subnet mask can do.

    Can a /24 start on any address?

    No. A prefix has to begin on a multiple of its own size, so a /24 starts on a whole final octet, a /26 on 0, 64, 128 or 192, and a /20 on a multiple of 16 in the third octet. 192.168.1.130/24 is a perfectly valid way to describe a host and its mask, but the range it names is 192.168.1.0/24 — this tool masks the host bits off and shows both, because writing the interface address and reading it back as the network is a common source of an off-by-one subnet.

    Should an IPv6 subnet ever be smaller than a /64?

    Rarely, and never on a LAN. SLAAC — the mechanism by which hosts configure their own addresses under RFC 4862 — requires exactly 64 interface identifier bits, so a /65 or longer breaks autoconfiguration outright. The usual practice is a /64 per link no matter how few hosts are on it, a /56 or /48 delegated to a site, and longer prefixes reserved for point-to-point links and loopbacks where nothing autoconfigures. Address exhaustion is not a concern: a single /64 holds more addresses than the entire IPv4 internet, squared.