Home Guides Calculator Guides

Calculator Guides

Subnet Calculator Guide: CIDR, Network and Host Addresses

Calculate IPv4 subnet boundaries and basic IPv6 prefix information from an IP address and CIDR prefix.

In this guide Step-by-step explanations, practical examples and useful context to help you complete the task confidently.

Learn how CIDR prefix length determines IPv4 network boundaries and how IPv6 prefixes identify the size of a network block.

IPv4 network address

The subnet mask determines which bits belong to the network portion of an IPv4 address. Applying the mask to the IP address produces the network address.

Broadcast and hosts

For an IPv4 subnet, the broadcast address is the highest address in the block. Traditional usable-host counts exclude the network and broadcast addresses, although /31 and /32 have special uses.

CIDR notation

A prefix such as /24 means 24 of the 32 IPv4 bits belong to the network prefix. A shorter prefix represents a larger address block.

IPv6 prefixes

IPv6 uses 128-bit addresses. A prefix such as /64 identifies the first 64 bits as the network prefix, leaving the remainder for interface addressing.

Practical uses

Subnet calculations help with network planning, address allocation, routing and troubleshooting.

Limitations

Real network designs can use special-purpose ranges, routing policies and provider allocations that require more context than a mathematical subnet calculation.

Worked example: IPv4 /24

An IPv4 /24 prefix uses 24 network bits and leaves 8 host bits. That creates 256 addresses in the block. Under the traditional host-address convention, 254 are usable because the network and broadcast addresses are reserved.

What changes when the prefix changes?

A /26 leaves 6 host bits and creates 64 addresses per block. A longer prefix therefore produces smaller blocks, while a shorter prefix produces larger blocks.

Do not confuse arithmetic with network policy

Routing, private ranges, reserved addresses, VLAN design and provider allocations can impose rules that are not visible from the subnet calculation alone.

IPv4 Host Count

An IPv4 prefix leaves 32 minus the prefix length as host bits. The total address count is 2 raised to that number of host bits. Under the traditional subnet convention, the network and broadcast addresses are not assigned to ordinary hosts.

Total IPv4 Addresses = 2^(32 − Prefix Length)

Worked Example: /26

An IPv4 /26 prefix leaves 6 host bits, giving 64 addresses in the block. Under the traditional convention, 62 are usable host addresses because the network and broadcast addresses are reserved.

Network and Broadcast Boundaries

The network address identifies the beginning of the block and the broadcast address identifies the end. The calculator can determine these boundaries from the address and CIDR prefix.

Subnet Size Changes With the Prefix

A /24 contains 256 IPv4 addresses, while /25 contains 128 and /26 contains 64. Increasing the prefix length therefore creates smaller blocks.

Special Cases

/31 and /32 prefixes have special uses in IPv4 networking, so the traditional usable-host calculation should not be applied blindly to every prefix.

IPv6 Is Different

IPv6 addresses contain 128 bits and commonly use /64 interface prefixes. IPv6 does not use the IPv4 network-and-broadcast host-count convention in the same way.

Do Not Confuse Calculation With Network Policy

Routing, reserved ranges, VLAN design, provider allocation and security policy require information beyond the mathematical subnet boundary.

Use the Tervilo Subnet Calculator

Use the Tervilo Subnet Calculator to inspect IPv4 network boundaries and basic IPv6 prefix information.

You've reached the end

Use the related tools, FAQs and next guides below to continue from the topic you just learned.

Use the solution

Try the Tervilo Tools

Finish the task with a practical Tervilo tool related to this guide.

Continue learning

Related Guides

Explore the next practical guide without leaving Tervilo.

Learn more

Related Articles

Understand the wider topic with an informative Tervilo article.