DevTools Logo

Subnet Calculator

Subnet Calculator

Derive network, broadcast, host range and masks from CIDR notation — IPv4 and IPv6, all in your browser.

IPv4 CIDR

Examples

Calculate a /24 from a host address

Input
192.168.1.42/24
Output
Network: 192.168.1.0
Broadcast: 192.168.1.255
Usable range: 192.168.1.1 – 192.168.1.254
Subnet mask: 255.255.255.0
Wildcard mask: 0.0.0.255
Total addresses: 256
Usable hosts: 254

Host bits are cleared for the network and set for the broadcast address, producing the standard /24 range.

Handle an RFC 3021 point-to-point subnet

Input
10.0.0.8/31
Output
Network: 10.0.0.8
Broadcast: 10.0.0.9
Usable range: 10.0.0.8 – 10.0.0.9
Subnet mask: 255.255.255.254
Wildcard mask: 0.0.0.1
Total addresses: 2
Usable hosts: 2

For /31, both addresses are treated as usable instead of subtracting network and broadcast addresses.

Expand an IPv6 /64 prefix

Input
2001:db8:abcd:12::/64
Output
Compressed: 2001:db8:abcd:12::
Expanded: 2001:0db8:abcd:0012:0000:0000:0000:0000
Prefix length: /64
Total addresses: 18,446,744,073,709,551,616

IPv6 mode normalizes the address and computes 2^(128−64) addresses; it does not mask host bits into a separate network address.

About this tool

Subnetting turns a single IP block into the network address, broadcast address, usable host range and masks your routers, firewalls and DHCP scopes actually need. Getting a CIDR prefix wrong by one bit silently changes all of those values, so this calculator does the bit math for you: enter an address in CIDR notation and read every derived value at a glance.

It handles the tricky edge cases correctly — a /31 point-to-point link has two usable addresses per RFC 3021, and a /32 is a single host route — and shows a colour-coded 32-bit map so you can see exactly where the network portion ends and the host portion begins. An IPv6 mode summarizes a prefix's compressed and expanded forms and the total number of addresses in the block. Everything is computed locally; no address you enter is uploaded.

How to use

  1. Enter a CIDR block

    Type an IPv4 address with a prefix, e.g. 192.168.1.0/24, or switch to IPv6 mode for a prefix like 2001:db8::/32.

  2. Read the subnet details

    See the network and broadcast addresses, usable host range, subnet mask, wildcard mask and host counts instantly.

  3. Inspect the bit map

    Use the coloured 32-bit map to see how many bits belong to the network vs. the host portion.

  4. Copy any value

    Copy the network, mask or host range to paste into router configs, ACLs or documentation.

Use cases

Planning a VLAN or DHCP scope

Derive network boundaries, broadcast address and usable IPv4 range before assigning hosts.

Writing firewall and routing rules

Copy the canonical network CIDR, dotted mask or wildcard mask into an ACL or route configuration.

Checking point-to-point links

Confirm both addresses in an IPv4 /31 are usable under RFC 3021.

Normalizing IPv6 notation

Convert a compressed IPv6 address to eight zero-padded groups and calculate the prefix address count.

What it derives

ValueMeaning
Network addressThe first address of the block — identifies the subnet
Broadcast addressThe last address — reaches every host on the subnet (IPv4)
Usable host rangeFirst to last assignable host address
Subnet maskDotted-decimal mask for the prefix (e.g. 255.255.255.0)
Wildcard maskInverse mask used by ACLs and OSPF
Usable hostsHost count, with RFC 3021 (/31) and /32 handled correctly

IPv4 and IPv6 supported — all math runs in your browser.

Common mistakes

Mistake:Entering a host address and assuming it is already the network address.

Fix:Use the calculated Network address and canonical CIDR row; host bits may change the entered value.

Mistake:Subtracting two usable addresses from every IPv4 block.

Fix:Respect the calculator's /31 and /32 handling: /31 has two usable point-to-point addresses and /32 represents one host.

Mistake:Reading Public as proof that an address is globally routable.

Fix:The classification only recognizes RFC 1918 private ranges; separately check loopback, link-local, documentation and other special-purpose space.

Mistake:Assuming IPv6 mode calculates the masked network boundary.

Fix:Use it for expansion, compression, prefix length and address count only; mask host bits with a dedicated IPv6 subnet tool when needed.

Frequently asked questions

References & standards