Skip to content

Subnet Calculator

Calculate subnet details from IP and mask.

IP address
Prefix length
Output

No result

About Subnet Calculator

Subnet Calculator takes an IPv4 address and a prefix length and works out the addressing facts for that block: the network address with the host bits cleared, the broadcast address with them all set, the range of addresses usable for ordinary hosts, and how many that leaves.

The prefix length is what defines the split, and the field accepts anything from zero to thirty-two. Those two extremes are legal but rarely what you want: a zero-length prefix matches every address in the IPv4 space, and a thirty-two describes a single address with no network left around it. Everything between them behaves as you would expect, with each step of the prefix halving the size of the block.

Two caveats apply. The usable host count comes from subtracting the network and broadcast addresses from the block size, which is the correct account for the common case but not for point-to-point links, where the two-address convention is used instead and no address is reserved. And the address itself is not range-checked, so an octet above 255 is accepted and produces a meaningless result. Feed it a valid address and the rest follows precisely.

The output covers the essentials and stops there. There is no wildcard mask, no binary or dotted-decimal mask shown alongside the prefix, no class of address, no reverse-DNS name for the block, and no check for whether the address is private, loopback or otherwise special-purpose. The tool also takes a prefix length rather than a subnet mask, so a mask written in dotted-quad form has to be converted to its prefix before it can be entered — and only IPv4 is understood at all, with no equivalent arithmetic for the 128-bit address space. There is no breakdown into usable subnets within a larger block, which is the step most people want next when subnetting rather than describing a single block.

How to use Subnet Calculator

  1. 1 Enter an IPv4 address in dotted-quad form.
  2. 2 Set the prefix length, between 0 and 32.
  3. 3 Read the network address, the broadcast address and the usable host range.
  4. 4 Check the host count against the prefix: each increment halves the block.

Frequently asked questions

What does the prefix length actually mean?

It is the number of leading bits that identify the network, so the remaining bits identify hosts within it. A shorter prefix means a larger block and more hosts, which is why every step down doubles the size.

How many usable addresses does a given prefix leave?

The block size minus the two reserved addresses, the network and the broadcast. That rule holds comfortably for prefixes of thirty and shorter. For a thirty-one it reports none, which reflects the formula rather than the point-to-point convention, and a thirty-two is a single host address rather than a network.

Does it support IPv6?

No, it works with 32-bit IPv4 addressing only. IPv6 prefix arithmetic runs on 128-bit addresses with a different notation, and doing it correctly needs a calculator built for that space.

Why is the host range narrower than the whole block?

Because the first address in the block names the network itself and the last is the broadcast, and neither can be assigned to a host. The usable range is what remains between them, which is why a block of 256 addresses yields 254 hosts.

Free, online, and private

Free to use

Subnet Calculator is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How Subnet Calculator behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Output rows four: Network, Broadcast, Host range (first to last) and Total hosts
Prefix input a number field limited to 0 – 32, clamped with Math.max(0, Math.min(32, …)) before use
Mask handling the mask is computed with ~0 << (32 - prefix) but is never printed — there is no mask row
Host total broadcast − network − 1, so the network and broadcast addresses are excluded from the figure
Address family IPv4 only — 32-bit shifts throughout, parsed by the same dotted-quad routine as IP to Decimal

Compiled from the implementation of this tool and checked against it by itoolnet.

What Subnet Calculator does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • An IPv6 address contains no dots, so the parser returns its "Invalid IP" text, parseInt turns that into NaN and the bitwise AND turns NaN into 0: ::1 with prefix 24 is reported as Network 0.0.0.0 and 254 hosts instead of failing.
  • The host total subtracts the network and broadcast addresses unconditionally, so a /31 reports 0 hosts and a /32 reports −1, and the Host range row prints the two addresses backwards for those point-to-point prefixes.
  • No mask is ever shown. The subnet mask is derived internally to get the network and broadcast addresses, but the four reported values never include 255.255.255.0 or its dotted form, so that part still has to be worked out separately.
  • A CIDR string pasted into the address box is not understood: 192.168.1.10/24 fails the dotted-quad test and drops into the same silent zero path, producing a 0.0.0.0 network rather than an error message.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to Subnet Calculator with the snippet below. It is free, runs entirely in your browser, and needs no signup.