Developer tool

IPv4 Subnet Calculator

Enter an IPv4 address with a CIDR prefix, such as 192.168.1.10/24, to see the subnet details.

Runs in your browser. No upload.

Network address
—
Subnet mask
—
Wildcard mask
—
Broadcast address
—
First usable address
—
Last usable address
—
Total addresses
—
Usable hosts
—

About this tool

IPv4 Subnet Calculator made simple.

The local IPv4 calculator shows the normalized network, mask, wildcard, broadcast address, address count and usable host range. It handles /31 point-to-point and /32 single-address prefixes explicitly; it does not calculate IPv6.

Guide

Using IPv4 Subnet Calculator

The IPv4 Subnet Calculator reads one address written with a prefix length, such as 192.168.1.10/24, and fills eight lines: network address, subnet mask, wildcard mask, broadcast address, first and last usable address, total addresses and usable hosts. It handles IPv4 prefixes from /0 to /32. It does not read IPv6, split a block into smaller subnets or check whether an address is in use.

How to use it

  1. Type an IPv4 address, a slash and a prefix length from 0 to 32 into the box, for example 172.16.5.130/26. The box opens with 192.168.1.10/24 already worked out.
  2. Press Calculate subnet. The eight result lines refresh. If the entry is wrong, a short message appears and the result lines are not reliable until you fix it.
  3. Use the network, mask and wildcard lines when you write a route, a firewall rule or an access list, and use the first and last usable lines as the host range.
  4. Check the usable hosts line before you plan a subnet, because it is two lower than the total for prefixes up to /30.

Worked examples

A common office network

You enter
Address
192.168.1.10/24
You get
Network
192.168.1.0
Mask
255.255.255.0
Wildcard
0.0.0.255
Broadcast
192.168.1.255
First
192.168.1.1
Last
192.168.1.254
Total
256
Usable
254

A /24 keeps the first 24 bits and leaves 8 for hosts, so there are 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 for devices.

Run through the tool’s own code.

An address in the middle of a block

You enter
Address
172.16.5.130/26
You get
Network
172.16.5.128
Mask
255.255.255.192
Wildcard
0.0.0.63
Broadcast
172.16.5.191
First
172.16.5.129
Last
172.16.5.190
Total
64
Usable
62

A /26 block holds 64 addresses and starts on a multiple of 64 in the last number. The address .130 falls in the block that starts at .128, so the tool reports that block, not .130.

Run through the tool’s own code.

A point-to-point link

You enter
Address
10.0.0.4/31
You get
Network
10.0.0.4
Mask
255.255.255.254
Wildcard
0.0.0.1
Broadcast
N/A (/31 point-to-point)
First
10.0.0.4
Last
10.0.0.5
Total
2
Usable
2

A /31 holds only two addresses and has no separate broadcast address, so both can be used by the two ends of a link. The tool shows a note in the broadcast line instead of an address.

Run through the tool’s own code.

When it helps

  • Work out how many devices fit in a network before you choose a prefix for an office, a lab or a home setup.
  • Find the network address of any host address to see whether two machines sit in the same subnet.
  • Get the wildcard mask for an access list or routing rule without doing the bit maths by hand.
  • Check your answers while you practise subnetting for a networking course.

Limits to keep in mind

  • It takes one IPv4 address with a prefix from /0 to /32. A dotted mask such as 255.255.255.0, a missing prefix, an octet above 255 or an IPv6 address is refused with a message.
  • After a refused entry, the result lines can still show numbers from an earlier calculation. Ignore them until the message says Done.
  • Leading zeros are read as ordinary decimal, so 010 counts as 10. Some systems read a leading zero as octal, so write octets without extra zeros.
  • It does not know which addresses are reserved, assigned or already in use on your network. It only does the arithmetic of the prefix.

Tips

  • Each extra bit in the prefix halves the block, so /25 holds 128 addresses and /26 holds 64. Use this to size a subnet quickly.
  • Compare the network lines of two hosts. If they match for the same prefix, the hosts share a subnet.
  • For private networks, stay inside the ranges reserved for them, such as 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

Sources

Common questions

About IPv4 Subnet Calculator.

What do I type into the IPv4 subnet calculator?

Type one IPv4 address, a slash and the prefix length, for example 192.168.1.10/24. The address does not have to be the first one in its block. The tool rounds it down to the network address of the block it belongs to.

Why are usable hosts two fewer than the total addresses?

In an ordinary subnet the first address names the network and the last one is the broadcast address, so neither is given to a device. That is why a /24 has 256 addresses but 254 usable hosts.

How does the tool treat /31 and /32 prefixes?

A /31 has two addresses and both count as usable, as described for point-to-point links in RFC 3021. A /32 is a single address, so the first, last and network lines all show it. In both cases the broadcast line holds a note.

What is a wildcard mask?

It is the subnet mask turned upside down: every bit is flipped. For 255.255.255.0 the wildcard is 0.0.0.255. Some router and firewall rules use it to say which part of an address may vary.

Can this tool work with IPv6?

No. It only handles IPv4 addresses with prefixes from /0 to /32, and an IPv6 address such as 2001:db8::1/64 is refused. IPv6 subnets use 128-bit addresses and need a different calculator.

Can I enter the mask instead of the slash number?

Not directly. The box expects the slash form. To convert a dotted mask, count the one bits in it. For example, 255.255.255.192 has 26 one bits, so type the address followed by /26.

Is the address I type sent anywhere?

The page states that it runs in your browser with no upload, and the calculation is plain arithmetic on the text in the box. Even so, avoid pasting addresses you are not allowed to share into any web page.

What input does an IPv4 subnet calculator need?

Enter an IPv4 address and prefix such as 192.168.1.10/24. The result normalizes the address to its network.

Does this calculate IPv6 subnets?

No. This tool handles IPv4 CIDR prefixes from /0 through /32.