Subnet Calculator
Compute network, broadcast, host range, wildcard mask and usable host count from any CIDR block. Supports IPv4 and IPv6. Runs entirely in your browser.
About CIDR calculation
CIDR notation (Classless Inter-Domain Routing) describes a range of IPs by a prefix length. 192.168.0.0/24 covers 256 addresses from 192.168.0.0 to 192.168.0.255. This calculator splits the range into network, broadcast, first and last usable host, the wildcard mask and total usable host count. Supports IPv4 and IPv6.
Everything runs in your browser. No request is sent over the network.
Examples
10.0.0.0/8- a full class A private range, 16.7M addresses.192.168.1.64/26- 64 addresses, useful for small subnets.2001:db8::/48- the standard IPv6 allocation for a single site.
How it works
An IPv4 address is a 32-bit number. The prefix length after the slash states how many of those bits, counted from the left, identify the network. The remaining bits identify a host inside it. A /24 therefore fixes 24 network bits and leaves 8 host bits, which gives 2^8 = 256 addresses. The subnet mask is the same information written as an address: 24 one-bits followed by 8 zero-bits is 255.255.255.0.
From input to result
- The network address is the input address combined with the mask using a bitwise AND. All host bits become zero.
- The broadcast address is the network address with all host bits set to one.
- The wildcard mask is the bitwise inverse of the subnet mask, so a mask of
255.255.255.192has the wildcard0.0.0.63. - The total number of addresses is 2^(32 - prefix). For ordinary subnets, usable hosts are the total minus two, because the network and broadcast addresses are not assigned to devices.
Worked calculation
Take 198.51.100.100/26. A /26 leaves 6 host bits, so each subnet holds 64 addresses and the mask is 255.255.255.192. The last octet 100 in binary is 01100100; ANDed with 11000000 it becomes 01000000, which is 64. The network address is 198.51.100.64, the broadcast address is 198.51.100.127, and the usable range runs from 198.51.100.65 to 198.51.100.126, which is 62 hosts.
Because the calculator always applies the mask, you can enter any address inside a subnet, not only the network address, and the result is the same.
Quick reference for common IPv4 prefixes
/30: 4 addresses, 2 usable, mask255.255.255.252/29: 8 addresses, 6 usable, mask255.255.255.248/28: 16 addresses, 14 usable, mask255.255.255.240/27: 32 addresses, 30 usable, mask255.255.255.224/26: 64 addresses, 62 usable, mask255.255.255.192/25: 128 addresses, 126 usable, mask255.255.255.128/24: 256 addresses, 254 usable, mask255.255.255.0
How to read the results
- Family: IPv4 or IPv6, decided by whether the address contains a colon.
- CIDR: the address and prefix as you entered them.
- Network: the first address of the block, with all host bits zero. This is the value used in routing tables and firewall rules.
- Broadcast: the last address of an IPv4 block. It is not shown for a /32, which has no separate broadcast address.
- Subnet mask and wildcard mask: two ways to write the same boundary. Masks are shown for IPv4 only. Routers and operating systems usually take the subnet mask, while access lists on some platforms take the wildcard form.
- First host and last host: the lowest and highest address you can assign to a device.
- Total addresses and usable hosts: the size of the block and the number of assignable addresses.
Edge cases
- /31: two addresses, both usable. This is the convention for point-to-point links, where a network and broadcast address would waste half of the block.
- /32: a single address, used for loopbacks and host routes. First and last host are the same address.
- /0: the whole address space, commonly written as the default route.
- IPv6: there is no broadcast address, no subnet mask and no reserved host address, so the first host equals the network address. Counts are shown as a power of two for prefixes shorter than /68, for example
2^64for a /64, because the exact number is too large to be useful. From /68 onward the exact count is displayed. - Input format: the prefix length is required. IPv4 octets must be written without leading zeros, and IPv6 addresses are expected in hexadecimal groups, with
::allowed once for a run of zero groups.
Worked examples
192.0.2.0/24
The result is network 192.0.2.0, broadcast 192.0.2.255, mask 255.255.255.0, wildcard 0.0.0.255 and a host range of 192.0.2.1 to 192.0.2.254. That is 256 addresses and 254 usable hosts, the typical size of a single LAN segment.
203.0.113.0/29
A /29 has three host bits, so 8 addresses. The network address is 203.0.113.0, the broadcast address is 203.0.113.7, and the usable hosts are 203.0.113.1 to 203.0.113.6. Six usable addresses suit a small block, for example a router, a firewall pair and a few servers.
2001:db8::/48
The tool reports the first address 2001:db8:: and the last address 2001:db8:0:ffff:ffff:ffff:ffff:ffff. A /48 contains 2^80 addresses. Since a standard IPv6 subnet is a /64, it can be divided into 2^16 = 65,536 subnets of that size.
Common problems and how to fix them
- Two subnets overlap: compare the network and broadcast addresses of both blocks. If one range lies inside the other, one of the prefixes is too short. A block can only be split cleanly on its own boundary, for example a /24 into two /25 blocks.
- A host cannot reach the gateway: check that the host address, the gateway and the mask belong to the same network. A wrong mask moves the network boundary and the host then sends local traffic to the router, or the other way round.
- An address is rejected as a host address: it may be the network or broadcast address of the subnet. Compare it with the first and last host shown in the result.
- An access list does not match: wildcard masks are inverted.
0.0.0.255matches a /24, whereas255.255.255.0would match something entirely different. - The input is not accepted: check for a missing prefix, an octet above 255, leading zeros in an IPv4 octet or an IPv6 address with more than one
::.