IP Subnet Calculator

Common
Examples: 10.0.0.1/8, 172.16.4.22/20, 203.0.113.5/31
Mask must be contiguous, for example 255.255.255.0.
Common
Examples: 2001:db8::1/64, 2001:db8:abcd:12::/56, ::1/128

Results

Enter an address to see network details.
Copied to clipboard

Sources

  1. Fuller, V. & Li, T. RFC 4632: Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan. IETF / RFC Editor, 2006.
  2. Mogul, J. & Postel, J. RFC 950: Internet Standard Subnetting Procedure. IETF / RFC Editor, 1985.
  3. Retana, A., White, R., Fuller, V. & McPherson, D. RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links. IETF / RFC Editor, 2000.
  4. Hinden, R. & Deering, S. RFC 4291: IP Version 6 Addressing Architecture. IETF / RFC Editor, 2006.
  5. Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G. & Lear, E. RFC 1918: Address Allocation for Private Internets. IETF / RFC Editor, 1996.

Formula

IPv4 network address: $$ Network = IP \;\text{AND}\; Mask $$IPv4 broadcast address: $$ Broadcast = Network \;\text{OR}\; Wildcard $$Wildcard mask: $$ Wildcard = 255.255.255.255 – Mask $$CIDR subnet mask rule: $$ Mask = p \text{ leading 1-bits followed by } (32-p) \text{ trailing 0-bits} $$Total IPv4 addresses in a subnet: $$ Total = 2^{\,32-p} $$Usable IPv4 hosts: $$ Usable = \begin{cases} 2^{\,32-p} – 2, & p \le 30 \\ 2, & p = 31 \\ 1, & p = 32 \end{cases} $$First usable host: $$ First = \begin{cases} Network + 1, & p \le 30 \\ Network, & p \ge 31 \end{cases} $$Last usable host: $$ Last = \begin{cases} Broadcast – 1, & p \le 30 \\ Broadcast, & p \ge 31 \end{cases} $$New prefix when dividing by subnet count: $$ p_{new} = p_{old} + \left\lceil \log_2(S) \right\rceil $$Subnet count produced by a new prefix: $$ Subnets = 2^{\,p_{new} – p_{old}} $$Addresses per new subnet: $$ SubnetSize = 2^{\,32-p_{new}} $$New prefix when dividing by required hosts per subnet: $$ p_{new} = 32 – \left\lceil \log_2(H + 2) \right\rceil $$IPv6 total addresses in a prefix: $$ Total_{IPv6} = 2^{\,128-p} $$Where: $$ p = \text{prefix length} $$ $$ S = \text{required number of subnets} $$ $$ H = \text{required hosts per subnet} $$

Embed This Calculator

Copy the code and paste it into your website:

<!-- IP Subnet Calculator from CalculateQuick.com -->
<iframe src="https://calculatequick.com/embed/ip-subnet/" width="100%" height="600" style="border:none;" referrerpolicy="no-referrer-when-downgrade" title="IP Subnet Calculator"></iframe>
<p style="font-size:14px;text-align:center;margin-top:8px;"><a href="https://calculatequick.com/technology/ip-subnet-calculator/">IP Subnet Calculator</a> by <a href="https://calculatequick.com">CalculateQuick</a></p>

Tip: Adjust height="600" if needed.

WordPress

  1. Edit the page or post
  2. Add a “Custom HTML” block
  3. Paste the embed code
  4. Update/Publish

Wix

  1. Click Add (+) → Embed Code → Embed HTML
  2. Paste the code
  3. Publish

Squarespace

  1. Add a Code block
  2. Paste the code
  3. Save

Shopify

  1. Online Store → Pages → Show HTML
  2. Paste the code
  3. Save

Webflow

  1. Add an Embed element
  2. Paste the code
  3. Publish

HTML

  1. Paste into your HTML file
  2. Upload to server

Cite This Calculator

CalculateQuick. (2026). IP Subnet Calculator. Retrieved from https://calculatequick.com/technology/ip-subnet-calculator/
"IP Subnet Calculator." CalculateQuick, 2026, https://calculatequick.com/technology/ip-subnet-calculator/.
CalculateQuick. "IP Subnet Calculator." Accessed July 5, 2026. https://calculatequick.com/technology/ip-subnet-calculator/.

Share

Send Feedback

Found a bug? Have a suggestion? Let us know.

Thank you for your feedback!

Calculating a Subnet From Any Address and Prefix

Type an IPv4 address with a prefix, like 192.168.1.10/24, and every field updates as you type. There is no calculate button. If you have a dotted mask instead of a prefix, switch to Decimal Mask mode and enter the address and mask separately, or pick the mask from the quick-select list.

The bit map at the top of the results shows all 32 bits of the address. Purple bits are the network portion, light bits are the host portion. Click any bit to flip it and watch the address change, or drag the prefix slider to grow or shrink the network. Watching the network address snap to a new boundary as the slider moves is the fastest way to build an intuition for how prefixes work.

Three tools below the main results cover the common follow-up jobs. Subnet Division splits the network by subnet count, host count, or a target prefix. The membership check tells you whether a given address falls inside the current subnet and whether it lands on the network or broadcast address. Every value has a copy button, and the Cisco ACL Wildcard line can be pasted straight into an access list.

Subnet Cheat Sheet

Every prefix from /0 to /32 with its dotted mask, wildcard mask, and host capacity. The usable count is total addresses minus the network and broadcast addresses. The starred /31 and /32 rows follow their own rules, covered in the next section.

CIDRMaskWildcardTotalUsable
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/3224.0.0.031.255.255.255536,870,912536,870,910
/4240.0.0.015.255.255.255268,435,456268,435,454
/5248.0.0.07.255.255.255134,217,728134,217,726
/6252.0.0.03.255.255.25567,108,86467,108,862
/7254.0.0.01.255.255.25533,554,43233,554,430
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122*
/32255.255.255.2550.0.0.011*

The /8, /16, and /24 rows are shaded because they fall on octet boundaries, where the mask is all 255s and 0s. Between those rows, the mask changes in one octet only. That octet is where the block increment lives, and the calculator reports it for whatever prefix you enter.

Point-to-Point Links and Host Routes

A /31 has two addresses and, on a point-to-point link, both are usable. RFC 3021 made this standard specifically to stop router-to-router links from burning a /30, which spends half its four addresses on network and broadcast. If your gear supports /31 on point-to-point interfaces, and virtually all modern routers do, there is no reason to keep allocating /30s for links.

A /32 is a single address, used for host routes and loopback interfaces on routers. It has no network or broadcast address, so a routing table entry like 10.0.0.1/32 means exactly one machine.

Cloud subnets play by different rules. AWS and Azure reserve the first four addresses and the last address of every subnet, so subtract five from the total rather than two. A /28 that shows 14 usable hosts in this calculator gives you 11 in a VPC. Oracle Cloud reserves three. Size cloud subnets a step larger than the raw numbers suggest.

Private and Special Address Ranges

The calculator labels the scope of whatever address you enter. These are the ranges you will meet most often, from the IANA special-purpose registry.

Hilbert curve map of all 4.29 billion IPv4 addresses colored by regional registry, with private, loopback, multicast, and reserved ranges highlighted, corporate legacy /8 blocks owned by Apple, Ford, Daimler and AT&T labeled, and the single-pixel 192.168.0.0/16 block called out
BlockRangePurpose
10.0.0.0/810.0.0.0 – 10.255.255.255Private (RFC 1918)
172.16.0.0/12172.16.0.0 – 172.31.255.255Private (RFC 1918)
192.168.0.0/16192.168.0.0 – 192.168.255.255Private (RFC 1918)
100.64.0.0/10100.64.0.0 – 100.127.255.255Carrier-grade NAT (RFC 6598)
127.0.0.0/8127.0.0.0 – 127.255.255.255Loopback
169.254.0.0/16169.254.0.0 – 169.254.255.255Link-local (APIPA)
192.0.2.0/24TEST-NET-1Documentation only
198.51.100.0/24TEST-NET-2Documentation only
203.0.113.0/24TEST-NET-3Documentation only
198.18.0.0/15198.18.0.0 – 198.19.255.255Benchmarking (RFC 2544)
224.0.0.0/4224.0.0.0 – 239.255.255.255Multicast

Two of these earn their keep daily. The 100.64.0.0/10 block means you are behind carrier-grade NAT, common on 4G and 5G connections, and port forwarding will not work there. The three TEST-NET blocks exist so documentation can show real-looking addresses without pointing at anyone’s actual network, which is why the examples on this page use them.

Splitting a Network Without Overlaps

Overlaps come from splitting a network in your head and getting a boundary wrong by one. The division table does the boundary math for you. Say you hold 10.20.0.0/16 and need four departments. Split by subnet count with 4, and you get 10.20.0.0/18, 10.20.64.0/18, 10.20.128.0/18, and 10.20.192.0/18. Each boundary is exactly the block increment apart, 64 in the second octet.

When departments need different sizes, allocate the largest first. A 500-host block needs a /23 (510 usable), a 200-host block needs a /24, and a pair of point-to-point links need /31s. Carving largest-first from the bottom of the range keeps every allocation on a clean boundary; going smallest-first fragments the space and forces awkward gaps later. After each carve, check the Next Subnet value to see where the following block must start, and drop any address into the membership check if you are unsure which subnet it belongs to. When a subnet approaches capacity, work out the utilization percentage before deciding whether to renumber, since anything above roughly 80 percent of usable addresses leaves too little headroom for DHCP churn.

Address planning is only half of a build-out. If the new subnets mean new switch closets, the physical side has its own math, from the weight of the copper cable runs between floors to standby battery capacity for the alarm panels sharing the comms room.

Reading the Binary

Every result on this page comes from one operation. Write the address and the mask in binary, AND them together bit by bit, and the result is the network address. Take 172.16.4.22/20. The third octet of the address is 4, or 00000100 in binary. A /20 mask covers the first four bits of that octet (11110000, which is 240), so the AND keeps the top four bits and zeroes the rest, leaving 0. Network address 172.16.0.0, broadcast 172.16.15.255, because the 12 host bits all set to 1 add 15 to the third octet and 255 to the fourth.

Binary breakdown of 192.168.1.10/24 showing 24 network bits, 8 host bits, the subnet mask, and the derived network, usable range, broadcast, and host count

The wildcard mask is simply the mask with every bit flipped, which is why 255.255.240.0 pairs with 0.0.15.255. Cisco ACLs match on wildcard bits, so pasting the mask where the wildcard belongs matches almost nothing, a mistake covered below. If bitwise arithmetic interests you beyond networking, the same logic drives how computers multiply binary numbers.

IPv6 Prefixes in Practice

IPv6 subnetting is simpler than IPv4 in one big way. Every LAN gets a /64, full stop. SLAAC address autoconfiguration requires 64 host bits, so resist the urge to conserve addresses with longer prefixes on normal segments. Conservation thinking belongs at the site level, where a /48 gives you 65,536 /64 networks and a /56 gives you 256. The calculator’s /64 Subnets Inside figure shows exactly how many LANs fit in whatever allocation your provider handed you.

There is no broadcast address in IPv6 (RFC 4291 replaced broadcast with multicast), so the last address in a prefix is just another usable address. When you write IPv6 addresses down, RFC 5952 wants lowercase hex, leading zeros dropped, and the longest zero run compressed with a double colon, which is the Compressed form the calculator outputs. One practical planning note, keep prefix lengths divisible by 4 where you can. Nibble-aligned prefixes map cleanly onto reverse DNS zones, and the calculator prints the exact zone name for any aligned prefix.

Common Subnetting Mistakes

Assigning the network or broadcast address to a host. The first and last addresses of any subnet below /31 are not usable, and a device configured with one will fail in confusing, intermittent ways.

Putting the gateway outside the subnet. A host at 192.168.1.50/26 cannot reach a gateway at 192.168.1.1, because /26 puts them in different subnets, 192.168.1.0 – 192.168.1.63 versus its neighbors. The membership check catches this in seconds.

Using the subnet mask where the wildcard belongs. An ACL written with 255.255.255.0 instead of 0.0.0.255 inverts the match. Copy the Cisco ACL Wildcard line from the results instead of converting by hand.

Trusting IPv4 host counts in the cloud. The five reserved addresses per subnet in AWS and Azure turn a “big enough” /28 into a too-small one. Plan against the provider’s usable count, not the classic one.

Defaulting everything to /24. It is the comfortable prefix, but a point-to-point link on a /24 wastes 252 addresses, and a 400-host floor forced into a /24 cannot grow. Right-size from the cheat sheet instead, and while you are changing habits, verify firmware images with a SHA-256 checksum before flashing the router you are about to renumber.