IP Subnet Calculator (IPv4 & IPv6 CIDR)

Calculate the network address, usable host range, broadcast address, subnet mask and wildcard mask for any IPv4 or IPv6 CIDR block, and split it into smaller subnets.

Updated · Free · Runs in your browser

IPv4 (10.0.0.1/24) or IPv6 (2001:db8::/48). If you leave off the /prefix, the value below is used.

IPv4 only. Leave at or below the prefix to skip.

Network —
Usable host range —
Hosts —
Subnet mask —
Broadcast address —
Wildcard mask —
Type —
Mask in binary —
    Was this calculator helpful?

    Subnets

    The formula

    Number of addresses = 2^(32 − prefix) for IPv4, 2^(128 − prefix) for IPv6
    Usable IPv4 hosts = addresses − 2 (network and broadcast), except /31 (2) and /32 (1)
    Network address = IP AND mask;  broadcast = network OR wildcard
    Wildcard mask = 255.255.255.255 − subnet mask
    Prefix to mask: /24 = 255.255.255.0, /26 = 255.255.255.192, /28 = 255.255.255.240

    Worked example

    1. 192.168.10.37/26:
    2. A /26 has 2^6 = 64 addresses, so the mask is 255.255.255.192 and the wildcard 0.0.0.63.
    3. 37 falls in the block 0–63, so the network is 192.168.10.0 and the broadcast 192.168.10.63.
    4. Usable hosts are 192.168.10.1 to 192.168.10.62: 62 hosts.
    5. Split into /28s, it becomes four subnets of 14 hosts: .0, .16, .32 and .48.

    What subnetting does

    Subnetting divides an IP network into smaller networks. Each subnet has a network address, a range of host addresses and, in IPv4, a broadcast address. Splitting networks improves security, by isolating departments, guests and devices such as cameras; limits broadcast traffic; and makes better use of address space. The prefix length in CIDR notation, such as /24, says how many leading bits identify the network. The remaining bits identify hosts, so a smaller prefix means a bigger network.

    Reading CIDR notation

    Classless Inter-Domain Routing (CIDR) replaced the old class A, B and C system in 1993. In 10.0.0.0/8, the first 8 bits are the network, leaving 24 bits and about 16.7 million addresses. A /24, the classic home or office network, has 256 addresses and 254 usable hosts. Each step up the prefix halves the size: /25 has 128 addresses, /26 has 64, /27 has 32, /28 has 16, /29 has 8 and /30 has 4. A /31 is used for point-to-point links, where both addresses are usable, and a /32 refers to a single host.

    Subnet masks and wildcard masks

    A subnet mask is the prefix written as a dotted IP address, with 1 bits for the network part: /24 is 255.255.255.0 and /26 is 255.255.255.192. Devices find their network by ANDing their IP address with the mask. A wildcard mask is the inverse of the subnet mask and is used in Cisco access control lists and OSPF configuration: the wildcard for /26 is 0.0.0.63. The calculator shows both, plus the mask in binary so you can see exactly where the network bits end.

    Private and special address ranges

    Three IPv4 ranges are reserved for private networks by RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These aren't routed on the public internet and are used behind NAT in homes and businesses. Other special ranges include 127.0.0.0/8 for loopback, 169.254.0.0/16 for link-local addresses when DHCP fails, and 100.64.0.0/10 for carrier-grade NAT. The calculator identifies which kind of address you've entered.

    IPv6 subnetting

    IPv6 addresses are 128 bits long, written as eight groups of hexadecimal digits, with consecutive zero groups shortened to ::. Subnetting works the same way, but the numbers are vastly larger. Standard LAN subnets are /64, which is required for stateless address autoconfiguration (SLAAC), and contain 18 quintillion addresses. Internet providers typically give homes a /56 or /48, allowing 256 or 65,536 /64 subnets. IPv6 has no broadcast address; it uses multicast instead.

    Quick reference: common IPv4 prefixes

    /30: 4 addresses, 2 hosts (255.255.255.252), traditional point-to-point links. /29: 8 addresses, 6 hosts (.248), small business static IP blocks. /28: 16 addresses, 14 hosts (.240). /27: 32, 30 hosts (.224). /26: 64, 62 hosts (.192). /25: 128, 126 hosts (.128). /24: 256, 254 hosts. /23: 512, 510 hosts (255.255.254.0). /22: 1,024, 1,022 hosts (255.255.252.0). /16: 65,536 addresses (255.255.0.0).

    Planning a network

    Start with the number of hosts each segment needs, add room for growth, and choose the smallest subnet that fits: a 50-device office needs at least a /26, and room to grow suggests a /25. Keep subnets aligned on their natural boundaries, and document your address plan. Use the split option to carve a larger block into equal subnets. For bandwidth planning, see the data transfer time calculator, and for storage on the network, the RAID calculator.

    Frequently asked questions

    How many hosts are in a /24?
    256 addresses, of which 254 are usable for hosts. The first is the network address and the last is the broadcast address.
    What is the subnet mask for /27?
    255.255.255.224. It has 32 addresses and 30 usable hosts.
    How do I find the network address?
    Perform a bitwise AND of the IP address and the subnet mask, or round the address down to the nearest multiple of the block size. For 192.168.1.130/25 the block size is 128, so the network is 192.168.1.128.
    What is a wildcard mask?
    The inverse of a subnet mask, used in Cisco ACLs and routing protocols. It has 0 bits where addresses must match and 1 bits where they can vary.
    Why is /64 the standard IPv6 subnet?
    IPv6 autoconfiguration (SLAAC) builds a host's address from a 64-bit interface identifier, so LAN subnets need 64 host bits.

    ↑↓ to navigate · Enter to open