IPv4 and IPv6 subnet calculator

Enter an address with a prefix or a subnet mask and get the network address, usable host range, broadcast, wildcard mask and address count. It also recognises private, documentation and other special-purpose ranges.

How to use it

  1. Enter an address with a prefix (192.168.1.130/24, 2001:db8:abcd::1/64), or an IPv4 address and a subnet mask separated by a space (10.1.2.3 255.255.240.0).
  2. Click Calculate. The result shows the network in CIDR notation, the mask, the address range and the type of range (private, public, documentation…).
  3. To find out whether a specific address belongs to the network – say, while writing a firewall rule – fill in Check an address as well.

How it works

CIDR (Classless Inter-Domain Routing) notation describes a block of addresses as an address plus a prefix length after a slash: 192.168.1.0/24 means the first 24 bits identify the network and the remaining 8 bits identify devices within it. The subnet mask 255.255.255.0 carries the same information.

The calculator comes in handy when planning an addressing scheme, writing firewall rules and ACLs, reading logs and incident reports (where does that suspicious address belong?) and checking whether two ranges overlap.

What the tool works out:

  • IPv4 – the network address, subnet mask and wildcard mask, broadcast address, first and last usable host, total addresses and usable hosts, and the mask in binary.
  • IPv6 – the network in compressed form per RFC 5952 and in full, the first and last address of the block, the address count and the number of /64 subnets.
  • Range type – private (RFC 1918), carrier-grade NAT (100.64.0.0/10), loopback, link-local, documentation, multicast, unique local (ULA) and others from the IANA registries.

If you enter an address without a prefix, the tool treats it as a single address (/32 for IPv4, /128 for IPv6).

FAQ

Are the addresses I enter sent anywhere?

No. The calculation runs in a script right in your browser; nothing is sent to a server or stored.

Why does a /24 have only 254 usable addresses?

In IPv4, the first address of a block is the network address and the last is the broadcast address, so they aren't normally assigned to devices. The exceptions are /31 (a point-to-point link under RFC 3021, where both addresses are usable) and /32 (a single address).

What is a wildcard mask?

The inverse of the subnet mask – ones wherever the mask has zeros. For a /24 it is 0.0.0.255. You'll meet it in access control lists (ACLs) on network devices and in OSPF configuration.

Why is there no broadcast or host count for IPv6?

IPv6 has no broadcast; multicast takes its place (RFC 4291). In principle every address in the block is usable. The standard subnet for end devices is a /64; for larger blocks the tool shows how many /64 subnets they contain.

How does the tool know an address is private or reserved for documentation?

It compares the block with special-purpose ranges from the IANA registries (for example 10.0.0.0/8, 192.168.0.0/16, 100.64.0.0/10, 2001:db8::/32, fc00::/7) and with the multicast ranges. An IPv4 block that isn't in this selection of special ranges is labelled public.

Sources

  1. IANA – IPv4 Special-Purpose Address Registry
  2. IANA – IPv6 Special-Purpose Address Registry
  3. RFC 4632 – Classless Inter-domain Routing (CIDR)
  4. RFC 3021 – Using 31-Bit Prefixes on IPv4 Point-to-Point Links
  5. RFC 4291 – IP Version 6 Addressing Architecture
  6. RFC 5952 – A Recommendation for IPv6 Address Text Representation

Was this tool helpful?

Missing something or found a bug? Let us know.

Updated