INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

CalculatorNetworking

IPv4 CIDR calculator: address range, subnet mask and total count

Calculate an IPv4 range’s first and last addresses, subnet mask and total count locally from an address and prefix such as /24. CIDR fixes a prefix of the 32-bit address. The total is not a count of assignable hosts.

Calculate CIDR

IPv4 prefixes /0–/32; no leading zeros. Calculation runs locally.

Preparing the calculator. The fixed examples below remain readable.

What you will learn

Interpret the range for an address and prefix, explain how changing the prefix changes its size, and distinguish arithmetic from AWS allocation rules.

Prerequisite

IPv4 is a 32-bit address written as four values from 0 to 255. The initial 192.0.2.17/24 is a documentation example; no network is probed.

A /24 fixes the first 24 bits

CIDR (Classless Inter-Domain Routing) writes an address followed by / and a prefix length. IPv4 has 32 bits: a /24 leaves eight variable bits, giving 2 to the eighth, or 256 combinations. A longer prefix leaves fewer variable bits and a smaller range.

Fixed example: 192.0.2.17/24 as 32 bits
Octet 11928 bits of the network prefix
Octet 208 bits of the network prefix
Octet 328 bits of the network prefix
Octet 4178 variable bits
Fix the first 24 bits192.0.2.0–25528 = 256 addresses
Network prefix: 24 bits
192.0.2 is fixed in this example; zeroing the remaining bits gives the start.
Variable part: 8 bits
The last octet ranges from 0 through 255: 256 addresses, not just the entered .17.

The entered IP need not be the range’s first address

Read the result for 192.0.2.17/24
FieldResultMeaning
First address / network192.0.2.0Keep the prefix and zero the variable bits
Last address192.0.2.255Set the variable bits to one
Subnet mask255.255.255.024 one bits followed by 8 zero bits
Total addresses256The combinations of the 8 variable bits

192.0.2.17 is one address within the /24. Its network begins at 192.0.2.0. A difference between the entered address and network address is therefore expected.

Compare /24 and /25 for the same IP

Compare prefix boundaries
InputRangeTotal
192.0.2.17/24192.0.2.0–192.0.2.255256
192.0.2.17/25192.0.2.0–192.0.2.127128
192.0.2.17/31192.0.2.16–192.0.2.172
192.0.2.17/32192.0.2.17 only1
192.0.2.17/0All IPv4 addresses4,294,967,296

Choose an option to see the result and explanation.

Changing /24 to /25 does what to the variable bits and total?
Read the answer and reason

Answer: One fewer variable bit; half as many addresses · The variable part decreases from eight bits to seven, so the total drops from 256 to 128. This is not a usable-host calculation.

Input supported by this calculator

Input format and scope
InputCalculator behavior
Four IPv4 values with /0 through /32Calculate range, mask and total
A /33 or an octet above 255Reject as invalid input
Leading zeroes such as 192.000.2.17Reject ambiguous notation
IPv6, hostnames and URLsNot supported by this calculator

The browser uses input for local arithmetic only: no saving, transmission, DNS lookup or connectivity test. Editing input asks you to calculate again; do not treat the previous range as the new input’s result.

Separate arithmetic totals from AWS assignable addresses

Normal AWS IPv4 subnets have /16 through /28 size constraints and reserve the first four and last addresses. A valid /32 or /0 arithmetic result does not establish that AWS accepts that subnet size. Separately review exceptions such as BYOIP.

Explain what changed in the result

  1. Calculate the start, end and total for 192.0.2.17/24.
  2. Change to /25 and explain why the total halves.
  3. Try /32 and compare its first and last addresses.
  4. Distinguish the arithmetic total from allocation rules in the intended environment.

Check, then explain in your own words

  1. Read the prefix and variable-bit count.
  2. Identify the range endpoints and mask.
  3. Do not equate total addresses with usable hosts.
Check your understanding: Does a total of 256 establish 256 assignable AWS addresses?

No. The total alone is insufficient.

AWS size and reservation rules are separate. The calculator does not determine provider-assignable counts or whether an API would accept a subnet.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.