IPv4 subnet calculator

IPv4 subnet calculator: use ipv4 address, cidr prefix length. Review the formula, worked example and calculation steps.

Inputs

Use the units shown
RESULT
—

Enter your values and select Calculate.

Formula & explanation
Block size = 2^(32−prefix); network = floor(address/block size)×block size

Variables & units

IPv4 address
Text input
CIDR prefix length
Numeric value · minimum 0, maximum 32

Worked example

192.168.1.130/24 belongs to 192.168.1.0/24, with mask 255.255.255.0 and 254 conventional usable hosts.

Assumptions

IPv4 only. /31 uses point-to-point semantics; /32 is a single host. Does not verify address allocation, routing or network security.

Formula version 1.0.0. JavaScript floating-point arithmetic applies. Results display up to 6 decimal places; stored values retain available precision. Use the units shown.

Calculated on your device. Your latest 100 calculations stay in this browser.