IP Subnet Calculator

Find the network address, broadcast address, usable host range, subnet and wildcard masks for any IPv4 or IPv6 address and prefix.

IP subnet calculator
IP version

You can also type CIDR notation in the address box, such as 10.0.0.0/8 or 2001:db8::/32.

Network

    Usable hosts exclude the network and broadcast addresses, except for /31 point-to-point links (RFC 3021) and single-host /32 routes. IPv6 has no broadcast address, so every address in the range can be assigned.

    On this page

    An IP subnet calculator takes an IP address and a prefix length or subnet mask and shows the network it belongs to: the network and broadcast addresses, the range of usable host addresses, the number of hosts and the matching masks. For example, 192.168.1.10 with a /24 mask (255.255.255.0) is in the 192.168.1.0/24 network, which has 254 usable hosts from 192.168.1.1 to 192.168.1.254 and a broadcast address of 192.168.1.255.

    The calculator handles both IPv4 and IPv6. It’s useful for network engineers planning address space, students preparing for networking exams, and anyone setting up a router, firewall rule, VPN or cloud network who needs to know exactly which addresses a subnet covers.

    How to use the IP subnet calculator

    1. Choose IPv4 or IPv6.
    2. Enter an IP address. Any address inside the subnet works; it doesn’t have to be the network address. You can also type CIDR notation, such as 172.16.5.200/26, and the prefix is picked up automatically.
    3. Choose the prefix length. For IPv4, the list shows each prefix with its dotted subnet mask, such as /26 (255.255.255.192).
    4. Select Calculate subnet. For IPv4 you’ll see the network, broadcast, host range, host count, subnet and wildcard masks, the binary and hexadecimal forms, the address class and whether the address is private or public. For IPv6 you’ll see the compressed and expanded forms, the network prefix, the first and last addresses and the size of the block.

    How IPv4 subnetting works

    An IPv4 address is 32 bits long, usually written as four numbers from 0 to 255 called octets. The prefix length says how many of those bits, counting from the left, identify the network. The remaining bits identify individual hosts within it.

    • Subnet mask: the prefix written as an address, with 1s for network bits and 0s for host bits. /24 is 11111111.11111111.11111111.00000000, or 255.255.255.0.
    • Network address: the IP address with all host bits set to 0, found by a bitwise AND of the address and the mask.
    • Broadcast address: the IP address with all host bits set to 1. Packets sent to it reach every host on the subnet.
    • Total addresses: 2 to the power of the number of host bits, so a /24 with 8 host bits has 2⁸ = 256 addresses.
    • Usable hosts: the total minus 2, because the network and broadcast addresses can’t be assigned to devices.
    • Wildcard mask: the inverse of the subnet mask, 0.0.0.255 for a /24. It’s used in access control lists and routing protocols such as OSPF.

    Worked example: a /26 subnet

    Take 172.16.5.200/26. A /26 leaves 6 host bits, so each subnet has 2⁶ = 64 addresses, and subnets start at multiples of 64 in the last octet: 0, 64, 128 and 192. Since 200 falls between 192 and 255, the network address is 172.16.5.192 and the broadcast address is 172.16.5.255. The usable hosts are 172.16.5.193 to 172.16.5.254, which is 62 addresses. The subnet mask is 255.255.255.192 and the wildcard mask is 0.0.0.63.

    Special cases: /31 and /32

    A /31 has only two addresses. Under RFC 3021, both can be used on a point-to-point link between two routers, with no network or broadcast address, which saves addresses. A /32 identifies a single host and is common in routing tables, firewall rules and loopback interfaces.

    Splitting a network into smaller subnets

    Each extra bit you add to the prefix halves the size of the subnet and doubles the number of subnets. Borrowing 2 bits from a /24 gives four /26 subnets of 64 addresses each. For 192.168.10.0/24, those subnets are:

    • 192.168.10.0/26: hosts .1 to .62, broadcast .63
    • 192.168.10.64/26: hosts .65 to .126, broadcast .127
    • 192.168.10.128/26: hosts .129 to .190, broadcast .191
    • 192.168.10.192/26: hosts .193 to .254, broadcast .255

    To find the right prefix for a group of devices, take the number of hosts you need, add 2, and round up to the next power of two. Fifty devices need 52 addresses, which rounds up to 64, so a /26 fits. Networks often mix sizes, a technique called variable-length subnet masking (VLSM): for example, a /25 for staff computers, a /27 for printers and phones, and /30 or /31 links between routers, all carved from one larger block. Allocate the largest subnets first so the smaller ones fit neatly into the gaps.

    IPv4 subnet cheat sheet

    PrefixSubnet maskAddressesUsable hosts
    /8255.0.0.016,777,21616,777,214
    /16255.255.0.065,53665,534
    /20255.255.240.04,0964,094
    /22255.255.252.01,0241,022
    /24255.255.255.0256254
    /25255.255.255.128128126
    /26255.255.255.1926462
    /27255.255.255.2243230
    /28255.255.255.2401614
    /29255.255.255.24886
    /30255.255.255.25242

    Address classes and private ranges

    Before CIDR was introduced in 1993, IPv4 addresses were divided into fixed classes by their first octet: Class A (1–126) with a /8 mask, Class B (128–191) with /16, and Class C (192–223) with /24. Class D (224–239) is used for multicast and Class E (240–255) is reserved. Classes no longer control how networks are allocated, but the terms are still used, and the calculator shows the class for reference.

    Some ranges are reserved for special uses, and the calculator labels them:

    • Private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These are used inside homes and organisations and aren’t routed on the public internet.
    • Loopback: 127.0.0.0/8, with 127.0.0.1 referring to the device itself.
    • Link-local: 169.254.0.0/16, which a device assigns itself when it can’t reach a DHCP server.
    • Carrier-grade NAT: 100.64.0.0/10, used by internet providers that share public addresses among customers.
    • Documentation: 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24, set aside for examples in books and manuals.

    IPv6 addressing

    IPv6 addresses are 128 bits long and written as eight groups of four hexadecimal digits separated by colons. To keep them readable, leading zeros in each group can be dropped, and one run of consecutive all-zero groups can be replaced with a double colon. So 2001:0db8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1. The calculator shows both the expanded and compressed forms, using the standard compression rules of RFC 5952.

    IPv6 has no broadcast address and no need to reserve a network address for hosts, so every address in a block is usable. Subnets are usually much larger than in IPv4. A typical local network is a /64, which contains 2⁶⁴, or about 18.4 quintillion, addresses. Sites are often given a /48, which contains 65,536 /64 subnets, and internet providers may hand a /56 or /48 to each customer.

    Worked example: an IPv6 /64

    For 2001:db8:85a3::8a2e:370:7334/64, the first 64 bits are the network prefix, 2001:db8:85a3::/64. The range runs from 2001:db8:85a3:0:0:0:0:0 to 2001:db8:85a3:0:ffff:ffff:ffff:ffff. The 2001:db8::/32 block is reserved for documentation, so the calculator labels it accordingly.

    Common IPv6 ranges

    • 2000::/3: global unicast, the public internet.
    • fc00::/7: unique local addresses, the IPv6 equivalent of private ranges.
    • fe80::/10: link-local addresses, present on every IPv6 interface.
    • ff00::/8: multicast.
    • ::1/128: loopback.

    Tips for subnet planning

    • Allow for growth. Choose a subnet with room for at least 20 to 30% more devices than you have today.
    • Keep subnets aligned. A subnet’s network address must be a multiple of its size. A /26 can start at .0, .64, .128 or .192, but not at .100.
    • Reserve addresses for infrastructure. Many teams set aside the first few usable addresses for the gateway, switches and other network equipment.
    • Avoid overlaps. Two networks joined by a VPN or cloud peering can’t use the same private range. Check before you choose.
    • Use /64 for IPv6 LANs. Features such as stateless address autoconfiguration (SLAAC) expect a /64 on local networks.

    Privacy

    The calculator runs entirely in your browser. The addresses you enter aren’t sent to a server or stored, so you can safely use it with internal network details.

    Related calculations

    Two other tools work well alongside this one: the binary calculator, to do binary arithmetic and convert binary to decimal, and the bandwidth calculator, to work out download times and the speed you need.

    Frequently asked questions

    254. A /24 has 256 addresses, minus the network and broadcast addresses.

    255.255.255.0. A /16 is 255.255.0.0 and a /8 is 255.0.0.0.

    Apply a bitwise AND between the IP address and the subnet mask, which sets every host bit to 0. For 192.168.1.10/24, the network address is 192.168.1.0.

    Raise 2 to the power of the number of host bits (32 minus the prefix) and subtract 2. A /27 has 2⁵ − 2 = 30 usable hosts.

    The inverse of the subnet mask, with 1s where the mask has 0s. For 255.255.255.0 it's 0.0.0.255. Wildcard masks are used in access lists and OSPF configuration.

    Classless Inter-Domain Routing. It writes a network as an address followed by a slash and the prefix length, such as 10.0.0.0/8, instead of using fixed address classes.

    10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They're used inside local networks and aren't routed on the public internet.

    Yes, on point-to-point links. RFC 3021 allows both addresses in a /31 to be used, since no broadcast address is needed.

    2⁶⁴, which is 18,446,744,073,709,551,616 addresses.

    Leading zeros in each group are dropped, and the longest run of all-zero groups is replaced with ::, which can appear only once.

    No. All calculations run in your browser.