What is the formula for the Subnet Calculator?
Subnet Calculator: size = 2^(32−prefix); network = floor(address/size) × size. Input definitions: address = IPv4 address; prefix = Prefix length. Use the selected convention throughout the calculation.
Determine the IPv4 network, mask, last address and address count from a prefix. For /31 the host count follows the point-to-point convention; /32 represents one address.
Check the stated input format, calculation convention and limits before using the result.
Check the example inputs, then calculate. Your values stay in this browser.
Only IPv4 is supported. /31 has no conventional broadcast address on a point-to-point link.
Subnet Calculator validates ipv4 address, prefix length before applying the displayed equation. Only IPv4 is supported. /31 has no conventional broadcast address on a point-to-point link.
Subnet Calculator: size = 2^(32−prefix); network = floor(address/size) × size. Input definitions: address = IPv4 address; prefix = Prefix length. Use the selected convention throughout the calculation.
Subnet Calculator baseline input: IPv4 address: 192.168.1.10; Prefix length: 24. Output: Network = 192.168.1.0; Subnet mask = 255.255.255.0; Last address = 192.168.1.255; Address count = 256; Usable hosts (RFC 3021 for /31) = 254. Substitute these values into the displayed equation to reproduce the result.
Content and calculation reviewed:
Understand the calculation
The prefix fixes network bits and leaves 32−prefix host bits. A /30 has 2²=4 addresses; 192.0.2.6 belongs to the block 192.0.2.4–192.0.2.7 with mask 255.255.255.252. Under the traditional broadcast convention, two addresses are usable hosts. /31 point-to-point links and /32 addresses use the separately stated exceptions.
size = 2^(32−prefix); network = floor(address/size) × size
The detailed guide adds variable definitions, a reproducible example, a practice question and model limitations.
From question to result