How to use it
- 1.Type an IP address with its prefix length (
192.168.1.10/24) or with its netmask (192.168.1.10 255.255.255.0). IPv6 works the same way:2001:db8::/48. - 2.Change the prefix length in the list next to it to see how the network grows or shrinks; every result updates as you type.
- 3.Read the network and broadcast addresses, the first and last usable host, the netmask and the wildcard mask, and copy any of them with one click.
- 4.To plan smaller networks, pick a size under "Split into subnets of" and copy the list of subnets.
- 5.The address bar keeps your input, so you can bookmark or share the calculation.
How CIDR, prefix lengths and netmasks fit together
An IPv4 address has 32 bits. The prefix length after the slash says how many of them, counted from the left, name the network; the rest number the hosts inside it. In 192.168.1.0/24 the first 24 bits are the network and the last 8 bits leave room for 256 addresses.
A netmask writes the same thing as an address: ones for network bits, zeros for host bits. /24 is 255.255.255.0, /20 is 255.255.240.0. The wildcard mask is the netmask inverted (0.0.0.255 for a /24); Cisco access lists and OSPF use it to say which bits may vary.
Each step in prefix length halves or doubles the network: a /25 is half a /24, a /23 is two of them. That is why subnets always start on a multiple of their own size.
Usable hosts: why a /24 has 254, not 256
In IPv4 the first address of a subnet is the network address and the last one is the broadcast address, so a /24 leaves 254 addresses for devices and a /30 leaves two. In practice the router takes one of the usable addresses as the gateway.
Two sizes are exceptions. A /31 has no network or broadcast address and both addresses can be used on a point-to-point link between two routers (RFC 3021). A /32 is a single address, for a loopback interface or a route to one host.
IPv6 has no broadcast, so every address in a block is usable. Subnets with devices on them are /64, because address autoconfiguration (SLAAC) needs 64 host bits; a site typically receives a /48 or /56 and splits it into /64 networks.
Private, shared and public ranges
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks: they are used inside homes and companies and never routed on the internet. 100.64.0.0/10 is shared space that internet providers use behind carrier-grade NAT.
The calculator names the type of every network, including loopback, link-local, multicast and the documentation ranges reserved for examples. For a public network it links to prefix lookup and WHOIS, where you can see who announces it and who it is registered to.
Questions and answers
How many hosts are in a /24 subnet?
A /24 has 256 addresses. Two of them are the network address and the broadcast address, so 254 can be assigned to devices. A /25 has 126 usable hosts, a /26 has 62, a /27 has 30, a /28 has 14, a /29 has 6 and a /30 has 2.
What is a wildcard mask?
It is the netmask with every bit flipped: 255.255.255.0 becomes 0.0.0.255. Cisco access control lists and OSPF network statements use wildcard masks, where a zero bit must match and a one bit can be anything.
Can I use a /31 subnet?
Yes, on point-to-point links. RFC 3021 lets both addresses of a /31 be assigned to the two ends of a link, which saves two addresses compared with a /30. Most routers support it; ordinary LANs with a broadcast domain still need a /30 or larger.
Why are IPv6 subnets /64?
Stateless address autoconfiguration (SLAAC) builds the host part of an address from 64 bits, so a network where devices pick their own addresses must be a /64. Shorter prefixes such as /48 and /56 are handed to sites and split into /64 networks, which is why the calculator counts how many /64 networks a prefix holds.
How do I convert a netmask to CIDR notation?
Count the one bits in the netmask: 255.255.255.0 has 24, so it is /24, and 255.255.240.0 has 20, so it is /20. Type the address with its netmask into the calculator and it shows the prefix length for you.