IPv4 CIDR / Subnet Calculator

Calculate the details of an IPv4 subnet from an address and a CIDR prefix or netmask: network and broadcast address, subnet and wildcard mask, first and last usable host, address counts, IP class and the binary form of the mask and network. The address type shows whether the address is private (RFC 1918), public, loopback, CGNAT, link-local, multicast or another special range, and every value updates as you type or drag the prefix slider. All calculations run locally in your browser.

How to use

  1. Type an IPv4 address into IP address / CIDR with a prefix (192.168.1.0/24), a dotted netmask (192.168.1.0/255.255.255.0) or a space-separated netmask (192.168.1.0 255.255.255.0); an address without a prefix is treated as /24.
  2. Drag the Prefix length slider or click one of the quick buttons /8, /16, /24, /25, /26, /27, /28, /30 or /32 to change the prefix; Reset restores 192.168.1.0/24.
  3. Read the results: network and broadcast address, subnet and wildcard mask, first and last usable host, total addresses, usable hosts, IP class, address type, binary mask and binary network.
  4. Click Copy next to any value to copy it to the clipboard.

Example

Input

IP address / CIDR: 172.16.5.130/26

Output

Network address: 172.16.5.128/26
Subnet mask: 255.255.255.192
Wildcard mask: 0.0.0.63
Broadcast address: 172.16.5.191
First usable host: 172.16.5.129
Last usable host: 172.16.5.190
Total addresses: 64
Usable hosts: 62
IP class: B
Address type: Private (RFC 1918)
Binary mask: 11111111.11111111.11111111.11000000
Binary network: 10101100.00010000.00000101.10000000

Frequently asked questions

Do I have to enter the network address?

No. Any address inside the block works: 172.16.5.130/26 is reduced to the network 172.16.5.128/26. IP class and Address type are determined from the address you typed.

Why are there two fewer usable hosts than addresses?

In a normal subnet the first address identifies the network and the last one is the broadcast address, so a /24 has 256 addresses but 254 usable hosts. A /31 is treated as a point-to-point link (RFC 3021) with both addresses usable and no broadcast address, and a /32 is a single address, shown as 1 usable host.

Can I enter a subnet mask instead of a prefix?

Yes. Write it after a slash (10.0.0.0/255.255.0.0) or after a space (10.0.0.0 255.255.0.0) and it is converted to the prefix length. The mask bits must be contiguous; a mask like 255.255.255.1 shows the error That is not a valid IPv4 subnet mask.

Does it support IPv6?

No. Only dotted-quad IPv4 addresses are accepted, and an IPv6 address shows the error That is not a valid IPv4 address. Nothing you enter is uploaded or logged.

Related tools