IPv4 CIDR Calculator & Subnet Planner

Calculate from CIDR

The IP does not need to be a network address. Example: 192.168.1.123/24 resolves to 192.168.1.0/24.

CIDR Bit Boundary

Each box is one bit. The red vertical line marks the /prefix boundary.

Network bits Host bits Prefix boundary

Subnet Details

Network CIDR
—
Subnet Mask
—
Network Address
—
Usable Addresses
—
First Usable Address
—
Last Usable Address
—
Broadcast Address
—
Total Addresses
—

Plan a Subnet by Host Count

Find the smallest traditional LAN subnet that fits your hosts. The IPv4 address above is used as the reference address.

CIDR Bit Boundary

Each box is one bit. The red vertical line marks the /prefix boundary.

Network bits Host bits Prefix boundary

Subnet Details

Network CIDR
—
Subnet Mask
—
Network Address
—
Usable Addresses
—
First Usable Address
—
Last Usable Address
—
Broadcast Address
—
Total Addresses
—
Unused Host Capacity
—

About this tool

Calculate an IPv4 network from any address/prefix pair, including an address that has host bits set. Inspect the network address, subnet mask, usable host range and broadcast address. Visualize each of the 32 IPv4 bits and where the prefix separates network bits from host bits. Calculations run in your browser. The last CIDR and host count are saved in your browser so the page reopens where you left off.

How to use

  1. Enter an IPv4 address with a CIDR prefix, such as 192.168.1.123/24.
  2. The calculator automatically normalizes the address to the network address and updates its details.
  3. Inspect the dark network bits, light host bits, and the prefix boundary in the bit visualization.
  4. Enter a required host count to find the smallest fitting LAN subnet, using the address above as an anchor.
  5. The second bit visualization and Subnet Details grid show the same breakdown for the suggested subnet.

Example

Input:              192.168.1.123/24
Network CIDR:       192.168.1.0/24
Subnet mask:        255.255.255.0
Usable hosts:       254
First usable:       192.168.1.1
Last usable:        192.168.1.254
Broadcast:          192.168.1.255

Hosts required:     50
Suggested network:  192.168.1.64/26
(If the reference IP is 192.168.1.123)

Subnet calculation rules

  • The prefix length determines how many leading bits belong to the network, regardless of whether the input address has host bits set.
  • Traditional IPv4 subnets with prefixes /0 through /30 reserve the network and broadcast addresses, leaving 2^(32-prefix) - 2 usable hosts.
  • For an input /31, both addresses can be used on a point-to-point link (RFC 3021), and there is no subnet-directed broadcast. A /32 identifies one individual address.
  • The host-count planner uses traditional LAN sizing: a /30 holds two hosts, a /29 holds three to six, and so on. A single address gets a /32. It does not suggest /31 point-to-point links.
  • The planner selects the subnet containing your reference IP; it does not search for a free subnet in your network.

FAQ

Can I enter 10.0.5.42/20 instead of the network address?

Yes. The calculator clears the host bits to find the containing network, so 10.0.5.42/20 becomes 10.0.0.0/20.

Why is the broadcast address unavailable for /31 or /32?

/31 point-to-point links treat both addresses as endpoints, while /32 is a single host address. Neither has a separate directed broadcast address.

How does the host-count calculator choose a subnet?

It picks the longest prefix that fits the requested usable host addresses, normally excluding two reserved addresses for the network and broadcast. For one address, it returns a /32.

Does the result reserve or allocate IP addresses?

No. This is a calculator, not an IP address manager. It does not check for conflicts or allocate addresses on any network.

Does this page support IPv6?

No. This tool is IPv4-specific because it calculates IPv4 broadcast addresses. IPv6 does not have broadcast addresses.