Subnet Calculator - IPv4 CIDR, Hosts & IP Range
Free subnet calculator for IPv4 CIDR planning. Calculate network and broadcast addresses, subnet and wildcard masks, host ranges, and usable capacity.
IPv4 Subnet Inputs
/0 through /32Subnet Results
This private /24 provides enough conventional addresses for a small LAN.
What Is a Subnet Calculator?
A subnet calculator turns an IPv4 address and a CIDR prefix into the complete address block that network equipment and documentation need. Instead of converting four octets to binary by hand, you can see the network address, broadcast address, dotted-decimal subnet mask, wildcard mask, total addresses, and usable host range in one result.
The tool is useful when you are designing a home or office LAN, assigning VLANs, checking a firewall rule, documenting a cloud VPC, or learning how IPv4 addressing works. It also helps verify an address copied from a ticket or configuration file before that value is used in a router, switch, security group, or route table.
- Network planning: Choose a prefix that gives each department, site, or service segment enough addresses without consuming an unnecessarily large block.
- Configuration review: Confirm that an IP belongs to the stated CIDR block and identify the exact first and last addresses covered by a rule.
- Cloud and VPN design: Check for overlapping private ranges before connecting VPCs, branch offices, containers, or remote-access pools.
- Study and troubleshooting: Compare common /16, /24, /26, /30, /31, and /32 cases while learning the relationship between masks and host bits.
For example, 192.168.1.50/26 is one of four equal blocks inside 192.168.1.0/24. It begins at 192.168.1.0, ends at 192.168.1.63, and has 62 conventional host addresses. The input IP identifies the block; the prefix determines its size.
After you size the address block, use the Bandwidth Calculator to estimate whether the link can support the devices and applications in that segment.
How the Subnet Calculation Works
IPv4 addresses contain 32 binary bits. The prefix length says how many leading bits identify the network, leaving 32 − prefix host bits. The calculator parses the address as an unsigned 32-bit integer, creates a contiguous mask, and uses bitwise operations to find the block boundaries.
network = IP AND mask
broadcast = network OR NOT(mask)
- Subnet mask: The first prefix bits are 1 and the remaining host bits are 0. A /26 is 255.255.255.192.
- Wildcard mask: The bitwise inverse of the subnet mask. A /26 is 0.0.0.63.
- Conventional usable hosts: Total addresses minus the network and broadcast addresses, or 2^(32 − prefix) − 2.
- Exceptions: A /31 has two point-to-point addresses under RFC 3021; a /32 is one host route.
Worked example: 172.16.45.200/20
There are 12 host bits, so the block contains 2^12 = 4,096 addresses and 4,094 conventional hosts. The mask is 255.255.240.0. Applying it to 172.16.45.200 produces network 172.16.32.0 and broadcast 172.16.47.255. The usable range is 172.16.32.1 through 172.16.47.254.
RFC 4632 describes CIDR prefixes as the mechanism for allocating and aggregating IPv4 address blocks. The arithmetic here is deterministic, but whether an address is routable, private, or allowed in a particular environment depends on the address registry and your network policy.
For a related transfer scenario, the Download Time Calculator converts file size and link speed into an expected duration.
According to IETF RFC 4632, CIDR uses a prefix length to describe the significant network bits of an IPv4 address and supports address aggregation beyond the old classful boundaries.
Four Key Subnetting Concepts
Four related ideas explain nearly every value in the results panel. Learning them makes it easier to choose a prefix instead of treating the calculator as a black box.
1. CIDR prefix
The number after the slash counts network bits. Increasing the prefix by one halves the total address block and usually halves the host capacity.
2. Subnet mask
The dotted-decimal representation of the same division. It is commonly used in device interfaces and makes the boundary visible by octet.
3. Network and broadcast
The network is the lowest address in the block and the broadcast is the highest. In a conventional subnet, those boundary addresses are not assigned to hosts.
4. Host capacity
Host bits determine how many addresses exist. Plan for gateways, infrastructure, static devices, DHCP clients, and growth rather than matching today’s device count exactly.
A wildcard mask is especially useful in access-control lists and routing protocol statements because it shows which bits may vary. For /24, the subnet mask is 255.255.255.0 and the wildcard is 0.0.0.255. Both describe the same 256-address block from different configuration perspectives.
If your network hosts storage or backups, the Data Transfer Cost Calculator can help estimate the cost of moving traffic between the resulting segments.
How to Use This Subnet Calculator
- 1Enter the IPv4 address: Use dotted decimal such as 10.20.4.18. Leading zeros are not needed, and every octet must be between 0 and 255.
- 2Choose the prefix: Use the quick buttons for common /16, /24, /26, and /30 blocks, or type any whole number from /0 to /32.
- 3Read the boundaries: The network and broadcast addresses show the full block covered by the input.
- 4Check usable capacity: Compare usable hosts with the number of devices, gateways, services, and growth allowance you need.
- 5Review the address label: Private, shared, loopback, link-local, multicast, documentation, and reserved labels indicate that routing treatment needs a policy check.
For a small office with 30 devices, /27 is the smallest conventional block that fits because it provides 30 usable hosts. If you need a gateway, printer, access points, and future growth, choose a larger block rather than using every available address on day one.
Benefits of Using a Subnet Calculator
- Faster address planning: Compare prefixes without repeatedly converting binary octets by hand.
- Fewer configuration errors: Validate network and broadcast boundaries before placing a CIDR value in a route, ACL, or cloud rule.
- Clear capacity decisions: See total addresses and conventional usable hosts together, making wasted space and undersized blocks easy to spot.
- Useful edge-case handling: /31 and /32 results are explained rather than silently applying the ordinary minus-two formula.
- Better documentation: Copy the mask, wildcard, range, and block type into diagrams, tickets, and runbooks.
The most important result is not always the largest possible subnet. A small, well-sized block can limit broadcast scope and simplify firewall policy, while a larger summarized block can reduce route-table complexity. Use the results with the goals of that network segment in mind.
For the physical infrastructure behind a planned segment, compare rack and facility requirements with the Server Power Calculator.
Factors That Affect Your Subnet Design
Device count and growth
Count endpoints plus gateways, network appliances, virtual interfaces, reserved addresses, and expected growth. A /28 has 14 conventional hosts; a /27 has 30.
Segmentation and security
Separate user, guest, management, server, and IoT traffic when policy requires it. The prefix controls the size of each broadcast domain but does not create security by itself.
Route summarization
Contiguous blocks can sometimes be summarized into a shorter prefix, reducing routing entries. Avoid overlapping summaries that hide a more specific security or service boundary.
Address registry status
RFC 1918 private space is intended for internal networks. Shared, loopback, link-local, multicast, and documentation blocks have different uses and should not be treated as ordinary public addresses.
Link type
Use the /31 two-address exception only on supported point-to-point links. A normal LAN generally needs a conventional prefix with distinct network and broadcast addresses.
According to IETF RFC 3021, /31 prefixes can conserve addresses on point-to-point links when both endpoints implement the rule. According to IETF RFC 1918, 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 are private address blocks for internal use.
The IANA IPv4 Special-Purpose Address Registry is the authoritative place to check special-use assignments as registries and operational guidance evolve.
Frequently Asked Questions
Q: What does this subnet calculator calculate?
A: It converts an IPv4 address and a CIDR prefix from /0 through /32 into the network address, broadcast address, subnet mask, wildcard mask, total addresses, usable host count, and first-to-last host range.
Q: How many usable hosts are in a /24 subnet?
A: A conventional /24 contains 256 total IPv4 addresses. The network and broadcast addresses are reserved, leaving 254 usable host addresses. The calculator displays both totals so you can distinguish block size from assignable capacity.
Q: What is the difference between a CIDR prefix and a subnet mask?
A: The CIDR prefix is the number after the slash, such as /26, while the subnet mask is its dotted-decimal form, 255.255.255.192. Both describe the same division between network bits and host bits.
Q: Why does a /31 show two usable addresses?
A: RFC 3021 defines a /31 exception for point-to-point IPv4 links. Both addresses can identify the two endpoints because the link does not need a conventional network and broadcast address pair. Use this result only where the connected equipment supports the convention.
Q: What does a /32 subnet represent?
A: A /32 contains one address and is normally used as a host route, loopback, or single-address policy match. The network, broadcast, first address, and last address are the same value, and the traditional usable-host count is zero.
Q: Does the calculator support private and reserved IPv4 ranges?
A: Yes. It labels common RFC 1918 private ranges, loopback, link-local, shared address space, multicast, documentation, and other special-purpose blocks. The label is a planning hint, not a replacement for your routing and security policy.