U

IP Subnet Calculator

Calculate IPv4 subnet details from a CIDR prefix length including usable hosts, subnet mask, total addresses, and address block information.
Subnet definition
24 bits
bits
1 bits32 bits
Reference IP

Summary

Address allocation

Total
Usable hosts
0
(0.00%)
Reserved (network + broadcast)
0
(0.00%)

Breakdown

Subnet mask (decimal)
0bits
Address block size
0
Subnets from /8 network
0subnets

Key Assumptions

  • This calculator models IPv4 subnetting using CIDR notation. IPv6 subnetting uses a different address space and is not included in this tool.
  • Two addresses in every subnet are reserved — the network address with all host bits set to zero and the broadcast address with all host bits set to one — and cannot be assigned to individual devices.
  • For prefix lengths of 31 and 32, the conventional usable-host formula breaks down. A /31 prefix is typically used only for point-to-point links with no broadcast requirement, and /32 identifies a single host address.
  • The calculator demonstrates subnet division from a theoretical /8 base network. Real-world allocations follow regional internet registry policies and ISP assignments.
  • Address block and host counts grow exponentially as the prefix becomes smaller. A /24 network accommodates 254 hosts while a /16 network accommodates 65,534 hosts.

Formula Used

Total Addresses = 2^(32 − prefix) Usable Hosts = 2^(32 − prefix) − 2 Subnets from /N = 2^(new_prefix − N) The subnet mask has prefix consecutive 1-bits followed by (32 − prefix) 0-bits.
Embed this calculator on your website

Add this embed page to your site — visitors use the calculator right from your page.

Master IPv4 Subnetting with the CIDR Prefix Calculator

Every device on a network needs a unique address, and subnetting is the discipline that decides how many addresses a segment gets, where the boundary between network and host sits, and how much room remains for growth. The IP subnet calculator on this page turns a CIDR prefix length into the essential planning numbers that network engineers, IT students, and home-lab enthusiasts reach for every time they design or troubleshoot an IPv4 network. Enter a prefix between slash one and slash thirty-two, optionally pin it to a sample IP address to visualise the block, and the calculator returns the total addresses in the subnet, the number of usable host addresses after reserving the network and broadcast identifiers, the subnet mask in dot-decimal form, and the number of subnets you could carve from a theoretical class-A base. The donut chart at the side shows at a glance how much of the address space is available for devices versus reserved for protocol functions.

Why Subnetting Matters in Real Networks

Without subnetting, every device on a link would sit inside the same broadcast domain, listening to every packet regardless of its intended recipient. That arrangement might work for a handful of machines, but it collapses under the weight of hundreds or thousands of endpoints, where broadcast storms and address exhaustion become daily headaches. Subnetting splits the network into smaller collision and broadcast domains, each with its own address range, and routers enforce the boundaries between them. The practical payoff is threefold: better performance because traffic stays local, tighter security because filter rules apply at the subnet edge, and efficient address usage because you do not assign a slash-eight block to a department with twenty printers. Every network design course starts with the same advice: plan your subnets before you plug in the first cable, and the prefix-length slider in this calculator is the fastest way to explore the consequences of each choice.

How CIDR Prefixes Define the Network-Host Boundary

Classless Inter-Domain Routing, or CIDR, freed the internet from the rigid class-A, class-B and class-C blocks that wasted millions of addresses during the 1990s. The slash prefix, a number from zero to thirty-two, states how many of the leftmost bits of a 32-bit address belong to the network identifier. A slash-twenty-four prefix says the first 24 bits identify the network and the remaining 8 bits identify the host, giving 256 total addresses of which 254 are usable. A slash-twenty prefix reserves 20 bits for the network and leaves 12 bits for hosts, producing 4,096 total addresses. The calculator applies the formula that the total address count equals two raised to the power of thirty-two minus the prefix length, then subtracts two for the network and broadcast reserved addresses unless the prefix is slash thirty-one or slash thirty-two, where the conventional reservation model no longer applies in the usual way. The address-donut visual makes the division between usable and reserved space immediate, so you never mistake the block size for the device capacity.

Building Subnets from Larger Blocks

One of the most common subnetting exercises starts with a large allocation and asks how many smaller subnets it can generate. If an organisation holds a slash-sixteen block and wants slash-twenty-four subnets, the math is two raised to the power of twenty-four minus sixteen, which is two to the eighth power, giving 256 subnets each accommodating 254 hosts. The calculator's subnet-from-slash-eight output generalises this pattern and shows how many subnets of the chosen prefix fit inside a /8 space. Move the slider from slash-eight to slash-twenty-eight and watch the subnet count jump from one to over a million. This feedback loop is exactly what IT planners need when negotiating with a regional internet registry for an address allocation: the prefix length you request determines how many customers or departments you can serve, and getting it wrong on either side means either wasting public addresses or running out of room before the contract ends. The address block size output confirms the same figure from the other direction, so you can cross-check the planning math in whichever framing makes more sense for the conversation.

The Subnet Mask in Dot-Decimal Notation

Before CIDR became universal, network engineers expressed the boundary with a subnet mask written as four octets in dotted-decimal form. A mask of 255.255.255.0 carries exactly the same meaning as a slash-twenty-four CIDR prefix, because the binary under the hood is twenty-four ones followed by eight zeros. The calculator computes the full mask from the prefix and displays it alongside the CIDR notation so that anyone working with legacy equipment, firewall rules, or training materials that still use the older convention can translate instantly. A mask of 255.255.240.0 corresponds to a slash-twenty prefix, and the binary pattern reveals why: the first two octets are all ones, the third octet has four ones and four zeros, and the fourth octet is all zeros. Learning to read masks in binary cements the understanding that the number after the slash is simply a count of consecutive one-bits from the left.

Classful Addressing and Why CIDR Replaced It

The internet's original addressing scheme divided the 32-bit space into three classes based on the first few bits of the address. Class A started with a zero bit and had an eight-bit network prefix leaving 24 bits for hosts, class B started with binary ten and used a 16-bit prefix, and class C started with binary one-one-zero and used a 24-bit prefix. The problem was obvious: a class A network offered over sixteen million addresses, far more than any single organisation needed, while a class C network offered only 254, which was too small for many. CIDR abolished the class boundaries and allowed any prefix length, so a mid-sized company could request a slash-twenty-two allocation with 1,022 usable hosts regardless of where the address sat in the traditional class map. The class system is now mainly a historical artifact, but many textbooks and certification exams still reference it, so the calculator includes class context for completeness.

Special Prefixes and Edge Cases

The slash-thirty prefix gives four addresses total, with two usable hosts, and is the workhorse of point-to-point WAN links where you only need two devices to talk to each other. Slash-thirty-one gives two addresses and is formally reserved for point-to-point links under RFC 3021, with neither address requiring a broadcast reservation. Slash-thirty-two identifies a single host address and is commonly used in routing table entries and firewall rules rather than for interface assignment. At the other end of the spectrum, a slash-zero prefix theoretically encompasses the entire IPv4 address space, a construct found only in default route entries. The calculator handles these edge cases in its formulas and notes where the standard minus-two rule no longer applies, so you never panic when the host count for a slash-thirty-one reads zero.

Practical Subnet Planning Workflow

A typical subnet design session works through four questions: how many devices need addresses today, how much growth is expected over the next three years, what prefix length gives enough headroom without excessive waste, and how many subnets of that size the organisation's current allocation supports. The calculator answers the third and fourth questions directly from the prefix slider and the subnet-multiplication output. For the first two questions, the usable-hosts figure tells you whether the prefix is too tight or too generous. Suppose a department needs 45 addresses and projects 20 percent annual growth for three years, taking the count to roughly 78 devices. A slash-twenty-five prefix provides 126 usable hosts, which covers the need with comfortable room. A slash-twenty-six provides 62 usable hosts, which works today but fails three years out unless address renumbering is acceptable. The slider lets you explore the trade-off between conservation and growth in seconds.

Private vs Public Addressing

The address ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are reserved by RFC 1918 for private use and are not routed on the public internet. Organisations commonly use the 10.0.0.0/8 range with further subnetting to build extensive internal topologies without consuming public addresses. The subnet math for private ranges is identical to public ranges; only the routability changes. A 10.0.0.0/8 private block subnetted with a slash-twenty-four mask yields 65,536 subnets, each supporting 254 devices, and the calculator's subnet-from-slash-eight output applies directly to that scenario. The combination of private addressing and subnetting is what allows corporate networks with tens of thousands of endpoints to operate behind a single public IP address at the internet edge, a design that has stretched the IPv4 address space decades beyond its original expected lifetime.

Connecting Subnet Math to Binary Fundamentals

At its root, subnetting is binary arithmetic dressed in decimal clothing. Every prefix, every mask, and every address range can be understood by writing the numbers in binary and counting the ones and zeros. The calculator exposes the prefix as the central variable and derives all other results from it, so the relationship between prefix length and address count becomes intuitive with repeated use. The power-of-two scaling means that each additional bit borrowed from the host portion doubles the number of subnets and halves the number of hosts per subnet, or vice versa when moving the other direction. That symmetry is the engine behind every subnetting decision ever made, and the calculator makes it visible without requiring a pencil, a binary conversion table, or a memorised chart of slash-sixteen through slash-thirty-two values. Run through a few example prefixes, watch the usable-hosts and subnet-count outputs respond, and the pattern locks into place.

Disclaimer

Results are provided as estimates for informational purposes only and may be inaccurate. Always verify outcomes with a qualified professional before making financial or personal decisions based on these calculations.

FAQs

Related Calculators