IPv4 Subnet Calculator and CIDR Network Mapper
Calculate IPv4 subnets, network addresses, broadcast IDs, usable host ranges, and wildcard masks instantly in your browser. Decode CIDR prefixes from /0 to /32 with real-time binary bitmask visualization and complete privacy — your internal corporate IP addresses and network topologies are never uploaded to any remote server. All processing happens locally in your browser.
IPv4 Subnet & CIDR Workspace
32-Bit Binary Bitmask Representation
255.255.255.00.0.0.255192.168.1.0192.168.1.255192.168.1.1 - 192.168.1.2542542560xC0A80101 (3232235777)What is an IPv4 subnet calculator?
An IPv4 subnet calculator takes an IPv4 address and a CIDR prefix and calculates the boundaries of the subnet that contains it. It can show the network address, broadcast address, subnet mask, wildcard mask, address range, total number of addresses, and the host range for ordinary IPv4 subnets.
Every IPv4 address contains 32 bits divided into four 8-bit octets. For example, 192.168.1.100 can be written in binary as:
11000000.10101000.00000001.01100100
A CIDR prefix such as /24 tells you how many of those leading bits identify the network. The remaining bits are available for addresses inside that subnet. A /24, for example, uses 24 network bits and 8 host bits and corresponds to the subnet mask 255.255.255.0.
The calculator performs these IPv4 calculations from the address and prefix you enter. Special-purpose prefixes such as /31 and /32 need different host-count rules from ordinary subnets, so they should not use the usual “subtract two addresses” formula.
How to calculate an IPv4 subnet
-
Enter an IPv4 address
Enter an address in dotted-decimal notation, such as
10.0.0.1,172.16.20.5, or192.168.1.50. Each octet must be an integer from0through255. -
Select a CIDR prefix
Choose a prefix from
/0through/32. The prefix is the number of leading network bits. For example,/24corresponds to255.255.255.0. -
Calculate the network boundary
For normal IPv4 subnet calculations, the network address can be derived using a bitwise AND between the IP address and subnet mask:
IP & Mask. -
Calculate the broadcast boundary
For conventional subnets from
/0through/30, the broadcast address is the highest address in the subnet and can be derived from the network address and the inverted subnet mask. -
Review the host range
For ordinary
/0through/30subnets, the first host is normally one address above the network address and the last host is one address below the broadcast address./31and/32use special rules explained below.
How many usable addresses are in a subnet?
The number of total IPv4 addresses in a subnet is:
Total addresses = 2^(32 - prefix)
For conventional subnets from /0 through /30, the usual host calculation is:
Usable hosts = 2^(32 - prefix) - 2
The two excluded addresses are normally the network address and broadcast address.
There are two important exceptions:
- /31: Contains two addresses. RFC 3021 allows both addresses to be used on compatible IPv4 point-to-point links, where separate network and broadcast addresses are unnecessary.
- /32: Represents one IPv4 address. It is commonly used for host routes, loopback addresses, and rules that target one specific address.
Cloud note: Cloud providers can reserve additional addresses inside a subnet. The protocol-level host count shown by a general subnet calculator may therefore be higher than the number of addresses a particular cloud platform makes available to your resources.
Common CIDR prefix reference
This reference shows several commonly used IPv4 prefixes, their subnet masks, wildcard masks, total address counts, and conventional usable-host counts. The /31 and /32 rows use their special-purpose behavior instead of the normal minus-two rule.
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Addresses | Typical Use |
|---|---|---|---|---|---|
/8 |
255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | Very large address blocks such as the private 10.0.0.0/8 range |
/12 |
255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | The private 172.16.0.0/12 address block |
/16 |
255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Large private networks and address-allocation parent blocks |
/20 |
255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | Large application, data-center, or private network segments |
/22 |
255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | Medium-sized network segments |
/24 |
255.255.255.0 | 0.0.0.255 | 256 | 254 | Common LAN and VLAN size |
/26 |
255.255.255.192 | 0.0.0.63 | 64 | 62 | Smaller server, device, or office segments |
/27 |
255.255.255.224 | 0.0.0.31 | 32 | 30 | Small infrastructure or service subnets |
/28 |
255.255.255.240 | 0.0.0.15 | 16 | 14 | Small routed network segments |
/29 |
255.255.255.248 | 0.0.0.7 | 8 | 6 | Small static-address allocations |
/30 |
255.255.255.252 | 0.0.0.3 | 4 | 2 | Traditional IPv4 point-to-point links |
/31 |
255.255.255.254 | 0.0.0.1 | 2 | 2 on RFC 3021 point-to-point links | Address-efficient point-to-point links |
/32 |
255.255.255.255 | 0.0.0.0 | 1 | 1 address | Host routes, loopbacks, and single-address rules |
IPv4 subnet calculation examples
| Example | IP / CIDR | Network | Broadcast | Host Range |
|---|---|---|---|---|
| Office LAN | 192.168.10.50/24 |
192.168.10.0 |
192.168.10.255 |
192.168.10.1 – 192.168.10.254 |
| Private application subnet | 10.100.18.20/20 |
10.100.16.0 |
10.100.31.255 |
10.100.16.1 – 10.100.31.254 |
| Small documentation subnet | 198.51.100.6/28 |
198.51.100.0 |
198.51.100.15 |
198.51.100.1 – 198.51.100.14 |
| Traditional point-to-point link | 172.16.250.1/30 |
172.16.250.0 |
172.16.250.3 |
172.16.250.1 – 172.16.250.2 |
The address block 198.51.100.0/24 is reserved for documentation and examples, making it suitable for demonstrations rather than real public deployments.
What is a wildcard mask?
A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask contains a 255, the corresponding wildcard octet is 0, and vice versa.
For example:
Subnet mask: 255.255.255.192
Wildcard mask: 0. 0. 0. 63
CIDR: /26
Wildcard masks are commonly associated with Cisco IOS access control lists and some routing configurations. Many other firewalls and cloud platforms use CIDR notation directly instead.
Use cases: where subnet calculations are useful
- LAN and VLAN planning: Choose a subnet large enough for workstations, phones, printers, wireless devices, and future growth.
- Cloud network design: Divide a larger private address block into smaller application, database, management, and public-facing network segments.
- Firewall and ACL configuration: Determine the exact network range represented by a CIDR prefix and calculate a wildcard mask where a platform requires one.
- VPN planning: Compare local and remote network ranges before connecting sites to reduce accidental address overlap.
- Container and cluster networking: Estimate how many addresses are available in Pod, node, or service address pools before deployment.
- Troubleshooting: Determine whether two IPv4 addresses fall inside the same configured subnet or require routing between networks.
Private IPv4 address ranges
RFC 1918 defines three address blocks for private networks. These addresses are intended for use inside private networks rather than global public Internet routing.
- 10.0.0.0/8:
10.0.0.0through10.255.255.255 - 172.16.0.0/12:
172.16.0.0through172.31.255.255 - 192.168.0.0/16:
192.168.0.0through192.168.255.255
Private addresses are commonly used behind routers, firewalls, VPNs, and Network Address Translation (NAT). The same private ranges can be reused independently by many different organizations.
Other special IPv4 ranges
Not every non-public address is an RFC 1918 private address. IPv4 also contains ranges reserved for other purposes.
- 127.0.0.0/8: Reserved for loopback communication within the local host.
127.0.0.1is the most familiar loopback address. - 169.254.0.0/16: IPv4 link-local addressing, commonly used when a device needs local-link communication without a configured routable address.
- 100.64.0.0/10: Shared address space defined by RFC 6598, commonly used by service providers for Carrier-Grade NAT.
These ranges serve different purposes and should not be described as ordinary RFC 1918 private address space.
Common subnetting mistakes
-
Applying the minus-two rule to every prefix:
The traditional network-and-broadcast reservation applies to ordinary subnets through
/30. RFC 3021 gives/31different semantics for compatible point-to-point links, and/32represents a single address. -
Choosing a subnet with no room for growth:
A conventional
/24provides 254 usable host addresses. A design that already needs close to that number may require a larger subnet or multiple smaller subnets. - Creating overlapping network ranges: Overlapping CIDRs can make routing, VPN connectivity, peering, and network policy much harder to configure correctly.
-
Confusing subnet masks and wildcard masks:
A subnet mask of
255.255.255.192corresponds to wildcard mask0.0.0.63. - Assuming every platform exposes every protocol-level address: Cloud and managed-network platforms may reserve additional IP addresses inside a subnet for platform infrastructure.
- Using /31 without checking device support: RFC 3021 point-to-point addressing should only be used when both endpoints and the surrounding network configuration support it.
How to tell whether two IPv4 addresses are in the same subnet
Apply the same subnet mask to each IPv4 address. If both calculations produce the same network address, the two addresses belong to the same subnet under that prefix.
For example:
192.168.1.20/24 → Network 192.168.1.0
192.168.1.150/24 → Network 192.168.1.0
Same network → same /24 subnet
By contrast:
192.168.1.20/24 → Network 192.168.1.0
192.168.2.20/24 → Network 192.168.2.0
Different network → routing is required
How packets are delivered on the local link depends on the network technology and operating system. On ordinary IPv4 Ethernet networks, ARP is commonly used to resolve local IPv4 addresses to link-layer addresses.
Privacy and browser-based subnet calculation
The subnet mathematics can be performed directly in your browser from the IPv4 address and prefix you enter. The calculation itself does not require a remote lookup or a server request.
This is different from an IP geolocation or public-IP lookup tool, which may need to contact a network service to retrieve external information.
Frequently Asked Questions
Why are two addresses normally removed from the usable host count?
For conventional IPv4 subnets from /0 through /30, the lowest address identifies the network and the highest address is the broadcast address. The usual host count is therefore 2^(32 - prefix) - 2. /31 and /32 are important exceptions and should not use this rule.
What is CIDR notation?
CIDR notation writes an IPv4 address or network followed by a slash and prefix length, such as 192.168.1.0/24. The number after the slash tells you how many of the 32 IPv4 bits belong to the network prefix.
What is the difference between a network address and a broadcast address?
For a conventional IPv4 subnet, the network address is the lowest address and identifies the subnet in routing and network calculations. The broadcast address is the highest address and can represent all hosts on that local subnet. RFC 3021 /31 point-to-point links are a special case and do not reserve separate network and broadcast addresses in the usual way.
Can I use a /31 subnet for a point-to-point connection?
Yes, when both endpoints support RFC 3021. A /31 contains two addresses, and both can be used as endpoint addresses on a compatible IPv4 point-to-point link.
What does a /32 IPv4 prefix mean?
A /32 identifies exactly one IPv4 address. It is commonly used for host routes, loopback addressing, routing policy, and firewall rules that need to match a single address.
Which IPv4 ranges are private under RFC 1918?
The three RFC 1918 private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. They are intended for private networks and are not globally routed as ordinary public Internet address space.
How can I check whether two IP addresses are on the same subnet?
Apply the same subnet mask or CIDR prefix to both addresses and compare the resulting network addresses. If the network addresses are identical, both IPs are in the same subnet under that prefix.
Does this subnet calculation require sending my IP address to a server?
The subnet calculation itself can run directly in the browser and does not require an external network lookup. This differs from geolocation or public-IP lookup tools, which may need to contact another service.
