IPv4 Subnet Calculator

Enter an IPv4 address and a prefix or subnet mask. You get the network, broadcast, usable host range, and address count, with the /31 and /32 special cases handled correctly.

Free forever All calculations happen in your browser. The IPv4 addresses you enter stay on this page and are never sent to our server.

For example 192.168.1.100. You can also type 192.168.1.100/24 here.

A prefix from /0 to /32, or a mask like 255.255.255.0.

Examples

This calculator needs JavaScript, which is turned off in your browser. When it runs, the math happens on this page and nothing is sent anywhere.

Reading the result

Every field comes from the same 32 bits. The mask says how many of them name the network.

Network is the address with every host bit set to 0. It names the subnet. Broadcast is the address with every host bit set to 1; a packet sent to it reaches every host on the subnet. On ordinary subnets neither one is assigned to a device, so a /24 has 256 addresses and 254 usable hosts.

The wildcard mask is the subnet mask inverted. Some routers and firewall rules use it instead of a mask.

Two devices can talk directly, without a router, only when each one’s address and mask place the other inside its own range. The Same Subnet Checker tests exactly that for a laptop and a camera or other device.

The /31 and /32 exceptions

/31 has only two addresses. RFC 3021 lets both be used on a point-to-point link between two routers, with no network or broadcast address. It isn’t a normal setting for a laptop and a camera on a LAN, and some devices reject it.

/32 is a single address. It shows up on loopback interfaces and in host routes. A device configured with a /32 treats no other address as local.

Common masks

Usable hosts exclude the network and broadcast addresses, except for /31 and /32.

PrefixSubnet maskAddressesUsable
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Questions

Is 255.255.255.0 the same as /24?

Yes. 255.255.255.0 is 24 one-bits followed by 8 zero-bits, so it’s written /24. Either form works in this calculator.

Why is 255.0.255.0 rejected?

A subnet mask must be a single run of ones from the left, then zeros. 255.0.255.0 has a gap, so it isn’t a valid mask. The same goes for 255.255.255.1.

Why does a /24 have 254 usable addresses, not 256?

The first address (.0) is the network address and the last (.255) is the broadcast address. Neither is assigned to a device, which leaves .1 through .254.

Does this page send my addresses anywhere?

No. The math runs in this page’s own script, and the values you enter are never sent anywhere. The page has no analytics, sets no cookies, and its security policy blocks its scripts from making network connections. Loading the page itself works like any website: your browser requests its HTML, CSS, and script files.