Subnet / CIDR Calculator

Instant network, broadcast, host range, and subnet-split math for IPv4 and IPv6 — 100% calculated in your browser, nothing sent anywhere.

Type an address below — results update as you type. No data leaves your browser.

Try
Results
Network Address 192.168.1.0
Broadcast Address 192.168.1.255
Subnet Mask 255.255.255.0
Usable Hosts 254
First Usable Host 192.168.1.1
Last Usable Host 192.168.1.254
Total Addresses 256
Wildcard Mask 0.0.0.255
Prefix Length /24
Address Class C
Address Type Private (RFC 1918)
Binary Breakdown
IP 11000000101010000000000100001010
Mask 11111111111111111111111100000000
Network bits · Host bits
Split into Subnets
Showing 4 of 4 subnets
# Network First Host Last Host Broadcast
1 192.168.1.0/26 192.168.1.1 192.168.1.62 192.168.1.63
2 192.168.1.64/26 192.168.1.65 192.168.1.126 192.168.1.127
3 192.168.1.128/26 192.168.1.129 192.168.1.190 192.168.1.191
4 192.168.1.192/26 192.168.1.193 192.168.1.254 192.168.1.255
Prefix / CIDR Reference Table
Prefix Mask Wildcard Addresses Usable Hosts
/32 255.255.255.255 0.0.0.0 1 1
/31 255.255.255.254 0.0.0.1 2 2
/30 255.255.255.252 0.0.0.3 4 2
/29 255.255.255.248 0.0.0.7 8 6
/28 255.255.255.240 0.0.0.15 16 14
/27 255.255.255.224 0.0.0.31 32 30
/26 255.255.255.192 0.0.0.63 64 62
/25 255.255.255.128 0.0.0.127 128 126
/24 255.255.255.0 0.0.0.255 256 254
/23 255.255.254.0 0.0.1.255 512 510
/22 255.255.252.0 0.0.3.255 1,024 1,022
/21 255.255.248.0 0.0.7.255 2,048 2,046
/20 255.255.240.0 0.0.15.255 4,096 4,094
/19 255.255.224.0 0.0.31.255 8,192 8,190
/18 255.255.192.0 0.0.63.255 16,384 16,382
/17 255.255.128.0 0.0.127.255 32,768 32,766
/16 255.255.0.0 0.0.255.255 65,536 65,534
/15 255.254.0.0 0.1.255.255 131,072 131,070
/14 255.252.0.0 0.3.255.255 262,144 262,142
/13 255.248.0.0 0.7.255.255 524,288 524,286
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/7 254.0.0.0 1.255.255.255 33,554,432 33,554,430
/6 252.0.0.0 3.255.255.255 67,108,864 67,108,862
/5 248.0.0.0 7.255.255.255 134,217,728 134,217,726
/4 240.0.0.0 15.255.255.255 268,435,456 268,435,454
/3 224.0.0.0 31.255.255.255 536,870,912 536,870,910
/2 192.0.0.0 63.255.255.255 1,073,741,824 1,073,741,822
/1 128.0.0.0 127.255.255.255 2,147,483,648 2,147,483,646
/0 0.0.0.0 255.255.255.255 4,294,967,296 4,294,967,294
Understanding Subnets & CIDR

A subnet mask tells a device which part of an IP address identifies the network and which part identifies the individual host on that network. In IPv4 it is written as four numbers like 255.255.255.0; every bit set to 1 marks a network bit, every bit set to 0 marks a host bit. Routers use this mask, not the IP address alone, to decide whether a destination is on the local network or needs to be forwarded elsewhere.

CIDR notation (Classless Inter-Domain Routing) writes that same mask as a slash and a number, e.g. /24. The number is simply the count of leading 1-bits in the mask — /24 means the first 24 bits are network bits, leaving the remaining 8 bits for hosts. This is why 192.168.1.10/24 and 192.168.1.10 255.255.255.0 describe exactly the same network; the calculator above accepts either form.

A /24 network has 256 total addresses (2 to the power of 8 host bits), but only 254 are usable by hosts. The very first address in the range is reserved as the network address (it identifies the subnet itself) and the very last address is reserved as the broadcast address (a message sent there reaches every host on that subnet). Subtracting those two reserved addresses from 256 gives the familiar 254 usable hosts.

The /31 and /32 prefixes are special cases where that rule does not apply. RFC 3021 defines /31 for point-to-point links (like a connection between two routers): with only two addresses total and no room for a separate network or broadcast address, both addresses are used as hosts. A /32 addresses exactly one single host and is commonly used in routing tables and firewall rules to match one specific IP address.

IPv6 uses the same CIDR idea but with 128-bit addresses instead of 32-bit ones, written as eight groups of hex digits with "::" allowed once to compress a run of zero groups. There is no broadcast address in IPv6 — multicast replaces it — and address space is so large that home networks are typically handed a /64 or /56, not a single address. Because the numbers involved (up to 2^128) are far beyond what a normal JavaScript number can represent exactly, this calculator does all IPv6 math with BigInt to stay accurate at any prefix length.

Subnet Calculator: IPv4 and IPv6 CIDR, Masks and Host Ranges

This subnet calculator takes an IPv4 or IPv6 address in CIDR notation and returns the network address, broadcast address, usable host range, subnet mask, wildcard mask and a bit-level breakdown, then splits the block into smaller prefixes. Enter 192.168.1.10/24 or 192.168.1.10 255.255.255.0 and the numbers update as you type. Everything is computed in your browser.

How to read CIDR notation

The number after the slash counts the leading 1-bits in the subnet mask. Those bits identify the network; the rest identify hosts inside it. A /24 has 24 network bits and 8 host bits, so it spans 2^8 = 256 addresses. The general form is 2^(32 − prefix) addresses for IPv4 and 2^(128 − prefix) for IPv6.

192.168.1.10/24 and 192.168.1.10 255.255.255.0 describe the same network, and the calculator accepts either form. A mask whose 1-bits are not one solid block — 255.255.0.255 — is rejected rather than silently normalised, because no routing implementation treats it as valid.

Worked example: 10.0.5.130/25 leaves 7 host bits, so the block holds 128 addresses and starts at the nearest 128-boundary below: network 10.0.5.128, broadcast 10.0.5.255, usable 10.0.5.129–10.0.5.254, 126 hosts.

Network address, broadcast address and the usable host range

Every IPv4 block spends two addresses on itself. All host bits set to 0 gives the network address, which names the subnet in routes; all host bits set to 1 gives the directed broadcast address, which reaches every host on the segment. Neither can be assigned to an interface, which is where the usable-host formula 2^(32 − prefix) − 2 comes from.

A /24 gives 256 − 2 = 254 usable addresses, a /26 gives 64 − 2 = 62, a /30 gives 4 − 2 = 2. The only exceptions are /31 and /32, below. Subtract one more for the gateway, which sits inside the block: a /29 leaves 5 addresses for hosts.

Subnet mask and wildcard mask

A subnet mask writes the prefix as dotted decimal: /26 is 255.255.255.192, because 26 one-bits fill three octets plus the top two bits of the fourth (128 + 64 = 192). A wildcard mask is its bitwise inverse, 0.0.0.63 for that same /26. The quick conversion is to subtract each octet from 255.

They are not interchangeable. Cisco and HP ACLs and OSPF network statements take wildcard masks; interfaces, DHCP scopes and routes take subnet masks. Writing 0.240.255.255 where 0.0.15.255 belongs is the classic way an ACL matches the wrong traffic.

IPv4 prefix quick reference: /24 down to /30

Prefix — subnet mask — wildcard mask — total addresses — usable hosts:

  • /24 — 255.255.255.0 — 0.0.0.255 — 256 — 254
  • /25 — 255.255.255.128 — 0.0.0.127 — 128 — 126
  • /26 — 255.255.255.192 — 0.0.0.63 — 64 — 62
  • /27 — 255.255.255.224 — 0.0.0.31 — 32 — 30
  • /28 — 255.255.255.240 — 0.0.0.15 — 16 — 14
  • /29 — 255.255.255.248 — 0.0.0.7 — 8 — 6
  • /30 — 255.255.255.252 — 0.0.0.3 — 4 — 2

Each step down halves the block. Upward, a /23 holds 510 usable hosts, a /22 holds 1,022 and a /16 holds 65,534. To size a subnet, add 2 and round up to the next power of two: 60 hosts needs 62, which rounds to 64 — a /26.

Splitting a block with VLSM

Variable-length subnet masking gives each segment the smallest prefix that fits it instead of cutting the block into equal pieces. Two rules: allocate the largest subnet first, and start every subnet on a multiple of its own size. Splitting 10.10.0.0/24 for a mixed site:

  • 10.10.0.0/25 — 126 usable — user VLAN
  • 10.10.0.128/26 — 62 usable — VoIP
  • 10.10.0.192/27 — 30 usable — printers
  • 10.10.0.224/28 — 14 usable — access points
  • 10.10.0.240/29 — 6 usable — management
  • 10.10.0.248/30 — 2 usable — router-to-firewall link
  • 10.10.0.252/30 — 2 usable — spare link

That is 128 + 64 + 32 + 16 + 8 + 4 + 4 = 256 addresses — the whole /24, no overlap, no gaps. Alignment is what makes it work: a /26 may only start at .0, .64, .128 or .192. The split view lists every child subnet with its network, first and last host and broadcast address.

RFC 1918 private ranges and other reserved blocks

Three IPv4 ranges are reserved for private use by RFC 1918 and are never routed on the public internet:

  • 10.0.0.0/8 — 10.0.0.0 to 10.255.255.255 — 16,777,216 addresses
  • 172.16.0.0/12 — 172.16.0.0 to 172.31.255.255 — 1,048,576 addresses
  • 192.168.0.0/16 — 192.168.0.0 to 192.168.255.255 — 65,536 addresses

The /12 is the one people get wrong: 172.16 through 172.31 are private, 172.32 is not. Also worth recognising are 100.64.0.0/10 (carrier-grade NAT, RFC 6598), 169.254.0.0/16 (link-local) and 127.0.0.0/8 (loopback). The calculator labels the category of whatever you enter, and the what is my ip address page shows the public address your traffic leaves from.

The /31 and /32 special cases

A /31 has two addresses and no room for a separate network and broadcast address, so RFC 3021 makes both usable — one per end of a point-to-point link. Using /31 instead of /30 on router interconnects halves the waste across a large network. Routers support it; some host operating systems, Windows among them, still refuse it on an interface.

A /32 is a single address: one total, one usable, no broadcast. It is the normal form for loopbacks, VPN clients, host routes and firewall rules matching one IP. IPv6 has the same idea in /127 for point-to-point links (RFC 6164) and /128 for a single address.

How IPv6 subnetting differs

IPv6 applies the same prefix arithmetic to 128 bits, written as eight hex groups with :: compressing one run of zero groups. Three things change in practice.

There is no broadcast address. Multicast replaced it — ff02::1 reaches all nodes on the link — so nothing is subtracted and the calculator reports total addresses rather than usable hosts.

/64 is the standard LAN size. Stateless autoconfiguration builds an address around a 64-bit interface identifier, so a LAN prefix longer than /64 breaks SLAAC. Do not subnet below /64 where hosts live; the accepted exception is /127 between two routers. An ISP delegates a /56 (256 /64s) or /48 (65,536 /64s) so you never need to.

The numbers stop being intuitive. One /64 holds 18,446,744,073,709,551,616 addresses. Ranges to know: 2000::/3 global unicast, fc00::/7 unique local, fe80::/10 link-local.

What this calculator does not tell you

This subnet calculator is arithmetic, not discovery: it cannot tell you whether a block is in use, overlaps a subnet elsewhere in your estate, or has a route to it. Nothing is scanned or pinged.

Usable-host counts assume the standard reservation of the network and broadcast addresses; very old gear also refused the all-zeros and all-ones subnets of a classful block, a restriction lifted by RFC 1878. And a public block's math says nothing about who holds it — run an ip address lookup against an address in the range and read the registry record.

Frequently asked questions

My ISP gave me a pool of /29 and /30 — how many usable IPs is that?

Six and two. A /29 holds 8 addresses and a /30 holds 4; in both cases the first address is the network address and the last is the broadcast address, so 8 − 2 = 6 usable and 4 − 2 = 2 usable. On the /30 one of the two is normally the ISP's router, leaving a single address for your equipment. The rule for any IPv4 prefix from /0 to /30 is 2^(32 − prefix) − 2.

How do I work out the broadcast address and host bits from a mask like 255.255.128.0?

255.255.128.0 is a /17 — 17 network bits, 15 host bits, 32,768 addresses, 32,766 usable. Convert the third octet to binary (128 = 10000000) and count the 1-bits to get the prefix. The broadcast address is the block's last address: for 172.16.0.0/17 that is 172.16.127.255, with the usable range running from 172.16.0.1 to 172.16.127.254.

My ISP gave me an IP with a /31 subnet and Windows says invalid address — can a /31 be used at all?

Yes, on a point-to-point link: RFC 3021 makes both addresses of a /31 usable because there is no room for a separate network and broadcast address. Routers from Cisco, Juniper, MikroTik and Linux accept it; Windows' IPv4 interface dialog generally does not, which is the error you are seeing. Configure the /31 on the router that terminates the circuit, not on a laptop.

What is the purpose of assigning a subnet mask of 255.255.255.255?

It pins the interface to exactly one address — a /32, one address total, one usable, no network or broadcast address to subtract. VPN clients, loopback interfaces, host routes and firewall rules use /32 so the host treats every other destination as off-link and hands it to the gateway or the tunnel. Seeing it on a SonicWall or AnyConnect adapter is normal, not a misconfiguration.

How do I choose a subnet mask when I need about 60 hosts per network?

Add 2 for the network and broadcast addresses, then round up to the next power of two. 60 + 2 = 62, which rounds to 64, so you need 6 host bits: a /26, mask 255.255.255.192, 62 usable. A 5-host segment sized the same way gives 7 → 8 → a /29 with 6 usable. Note that four /26s consume an entire /24, so a fifth subnet needs a separate block.

My VLAN is 10.5.0.1 with mask 255.255.240.0 — is 0.240.255.255 the right wildcard mask for the ACL?

No — the correct wildcard is 0.0.15.255. A wildcard mask is the subnet mask inverted octet by octet, so subtract each octet from 255: 255−255 = 0, 255−255 = 0, 255−240 = 15, 255−0 = 255. That /20 covers 10.5.0.0 through 10.5.15.255, which is 4,096 addresses and 4,094 usable hosts. Getting the octets in the wrong order matches traffic you never intended to permit.

If my ISP switches to IPv6, will it issue one IPv6 address per device in my house?

No — the ISP delegates a prefix, typically a /56 or a /48, and your router splits it into /64s, one per LAN. A single /64 holds 18,446,744,073,709,551,616 addresses, so 101 devices costs nothing; each one builds its own address from that prefix via SLAAC. Nobody bills per address, and you never subnet below /64 on a LAN because autoconfiguration expects a 64-bit interface identifier.