Tool

IPv4 Subnet, CIDR and Mask Calculator

Convert CIDR and masks or calculate the full range of an IPv4 subnet right in your browser.

Your data is processed locally in your browser and is not sent to our servers.

IPv4 subnet data

Convert a prefix or netmask. Add an IPv4 address to also calculate the network, broadcast and range.

Quick examples

Enter a CIDR prefix or IPv4 netmask.

Quick answer

Enter any IPv4 address in the block and a prefix or netmask. The result first explains which network contains the address and its usual host range, then keeps network, broadcast, mask, wildcard, sizes, and binary values available for copying or auditing. Quick examples compare /24, /27, /31, and /32 without manual setup.

Verifiable example

For address 192.168.1.42 with prefix /24, the result is:

Field Result
Network 192.168.1.0/24
CIDR prefix /24
Mask 255.255.255.0
Wildcard 0.0.0.255
Broadcast 192.168.1.255
First host 192.168.1.1
Last host 192.168.1.254
Total addresses 256
Usable addresses 254

The address belongs to that block because the first 24 bits identify the network and the remaining 8 identify addresses within it.

How to read each result

  • CIDR network combines the first address in the block with its prefix.
  • Network address is the lower endpoint; in /0 through /30 it identifies the subnet and is not assigned as a conventional host.
  • Broadcast is the upper endpoint in /0 through /30.
  • First and last usable delimit the conventional host range; /31 and /32 use the special rules explained below.
  • Wildcard inverts each mask bit and is used in configurations that express which bits may vary.
  • Total and usable addresses distinguish the complete block size from the addresses normally assignable to hosts.

Convert CIDR and mask without an IP address

You don’t need an address to convert the two notations. Enter 24, /24 or 255.255.255.0 in the prefix or mask field. The three values represent the same 24 network bits and produce:

Field Result
CIDR prefix /24
Mask 255.255.255.0
Wildcard 0.0.0.255
Total addresses 256
Usable addresses 254

If you add an IPv4 address, the tool applies that mask to calculate the block’s network address and range.

How to calculate an IPv4 subnet

An IPv4 address contains 32 bits. The CIDR prefix indicates how many belong to the network. The calculator builds the mask, applies a bitwise AND to the address and mask to obtain the network address, and uses the remaining host bits to find the last address in the block.

If you want to reproduce the procedure without depending on the tool, follow the guide how to calculate an IPv4 subnet step by step, which works through a /27 example using block size and binary notation.

For prefixes from /0 to /30, the first address identifies the network and the last is the broadcast address. The addresses between them form the conventional usable host range.

What happens to /31 and /32

A /31 network contains two addresses. In point-to-point links, both are interpreted as host addresses, with no dedicated broadcast, according to RFC 3021.

A /32 route contains a single address and is used as a host route. The block size table in RFC 4632 identifies /31 as a point-to-point link and /32 as a host route.

Common errors

  • Each octet must be a decimal number between 0 and 255.
  • The address must contain exactly four octets.
  • The prefix must be an integer between 0 and 32.
  • You can also write the prefix with /, for example /27.
  • A decimal mask must contain contiguous network bits; 255.0.255.0 is not a valid subnet mask.
  • The tool rejects leading zeros to avoid ambiguous interpretations.
  • The IP is optional and is written separately from the prefix or mask.

Borderline cases

  • /0 represents the entire IPv4 space: 4,294,967,296 addresses.
  • /31 returns two usable endpoints for a point-to-point link.
  • /32 returns a single address and does not show broadcast.
  • The calculator accepts any syntactically valid IPv4 without classifying it as public or private or inferring whether it can be routed on the Internet.
  • Address calculations use 32-bit integers and do not contact an external network.

If a device unexpectedly assigns itself 169.254.x.x, calculate 169.254.0.0/16 here to inspect the range, then use the 169.254 and APIPA troubleshooting guide to check DHCP, link scope, and the missing gateway. The calculator cannot test the DHCP exchange or network path.

Frequently asked questions

Does the address entered have to be the network address?

No. You can enter any address in the block. The result normalizes the network by applying the corresponding mask.

Can I convert a mask to CIDR without knowing the IP?

Yes. The equivalence depends only on the contiguous leading one bits of the mask. For example, 255.255.255.224 is equivalent to /27 even if you do not enter an IP.

Why does a /24 have 254 usable addresses?

The block contains 256 addresses. In a conventional subnet, the first identifies the network and the last is reserved for broadcast.

Is the address I calculate saved?

No. The input and results remain in the current tab and disappear when you reload or close the page.

Reviewed on by Tools in a Tab.