IPv4 Subnet Calculator
Free IP subnet calculator for IPv4. Enter an IP address with a CIDR prefix or subnet mask to get the network address, broadcast address, usable host range, wildcard mask and a full subnet breakdown.Subnet details
| IP address | |
|---|---|
| Network address | |
| Broadcast address | |
| First usable host | |
| Last usable host | |
| Usable host range | |
| Subnet mask | |
| Wildcard mask | |
| CIDR notation |
Binary breakdown
| Hex IP | |
|---|---|
| Decimal IP | |
| Reverse DNS (PTR) name | |
| Reverse DNS zone | |
| SPF mechanism |
Divide into smaller subnets
| # | Network | Usable range | Broadcast |
|---|
How to Use the IPv4 Subnet Calculator
Four steps from an address to a full subnet breakdown. Nothing you type leaves your browser, so you can safely paste internal addressing.
Enter an IPv4 address
Type any address, such as 192.168.1.10. You can also paste CIDR notation (10.0.0.0/8) or an address followed by a dotted subnet mask (192.168.1.10 255.255.255.0). The calculator reads all three forms.
Pick the subnet mask or CIDR prefix
Choose a prefix from /0 to /32. Each option shows its dotted-decimal subnet mask, so you can select by either format. Pasting a prefix into the address box selects it for you.
Read the subnet breakdown
You get the network address, broadcast address, first and last usable host, total and usable host counts, wildcard mask, IP class, address type, the binary breakdown, the reverse DNS (PTR) name and zone, and the SPF ip4: mechanism for a public block.
Split the network into smaller subnets
Use "Divide into smaller subnets" to break the block into equal-size subnets and list every network, usable range and broadcast address. The subnet holding your address is highlighted.
What Is an IPv4 Subnet?
An IPv4 subnet is a contiguous block of IP addresses that share the same network prefix. Every IPv4 address is 32 bits long, written as four octets, for example 192.168.1.10. Subnetting divides those 32 bits into two parts: the network portion, which identifies the subnet, and the host portion, which identifies individual devices inside it.
Splitting a large network into smaller IPv4 subnets reduces broadcast traffic, keeps routing tables manageable, and lets you apply security rules such as firewall policies, ACLs and SPF records to precise address ranges instead of entire networks.
What is a subnet mask?
A subnet mask is a 32-bit value that marks which bits of an IPv4 address belong to the network. The network bits are set to 1 and the host bits to 0. For example, 255.255.255.0 is 24 ones followed by 8 zeros, so the first three octets identify the network and the last octet identifies hosts.
What is the subnet prefix length in IPv4?
The subnet prefix length is the number of 1-bits in the subnet mask, written after a slash in CIDR (Classless Inter-Domain Routing) notation. 192.168.1.0/24 means the first 24 bits are the network prefix, which is the same as the mask 255.255.255.0. IPv4 prefix lengths run from /0, the entire address space, to /32, a single host. Windows, macOS and most routers ask for either the prefix length or the dotted subnet mask, and this calculator converts between the two.
How to Calculate an IPv4 Subnet by Hand
You can work out any IPv4 subnet in four steps. Here is the math for 172.16.5.130/27, the same result the calculator above produces.
- Convert the prefix to a mask. /27 means 27 network bits, so the mask is
255.255.255.224. The last octet is11100000in binary, which equals 224. - Find the block size. Subtract the interesting octet of the mask from 256: 256 - 224 = 32. Subnets in the last octet therefore start at 0, 32, 64, 96, 128, 160, 192 and 224.
- Find the network address. Take the largest multiple of 32 that is less than or equal to 130. That is 128, so the network address is
172.16.5.128. - Find the broadcast address and host range. The next subnet starts at 160, so the broadcast is one below it:
172.16.5.159. Usable hosts run from.129to.158.
| IP address and prefix | 172.16.5.130/27 |
|---|---|
| Subnet mask | 255.255.255.224 |
| Wildcard mask | 0.0.0.31 |
| Network address | 172.16.5.128 |
| Broadcast address | 172.16.5.159 |
| Usable host range | 172.16.5.129 - 172.16.5.158 |
| Usable hosts | 2^5 - 2 = 30 |
Formula for usable hosts: 2^(32 - prefix) - 2. The two addresses you subtract are the network address, where every host bit is 0, and the broadcast address, where every host bit is 1. Two exceptions apply: a /31 has 2 usable addresses for point-to-point links (RFC 3021), and a /32 identifies a single host.
What Subnet Mask Do I Need for a Given Number of Hosts?
Find the smallest power of two that is at least your host count plus 2, then subtract its exponent from 32. For 40 devices: 40 + 2 = 42, the next power of two is 64, which is 2^6, so you need a /26 (255.255.255.192), giving 62 usable hosts.
Use a (), which gives usable addresses. A single host on its own, such as a loopback address, can use a /32 instead. On a point-to-point link, a /31 also works (RFC 3021). Enter a host count between 1 and 4,294,967,294.
IPv4 Subnet Mask Cheat Sheet (CIDR Chart)
Every IPv4 prefix length with its subnet mask, wildcard mask and host count. Choose any prefix to load it into the calculator.
| CIDR | Subnet mask | Wildcard mask | Total addresses | Usable hosts | Notes |
|---|---|---|---|---|---|
| 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | ||
| 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | ||
| 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | ||
| 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | ||
| 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | ||
| 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | ||
| 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | ||
| 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | ||
| 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | Class A default | |
| 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | ||
| 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | ||
| 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | ||
| 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 172.16.0.0/12 private block | |
| 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | ||
| 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | ||
| 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | ||
| 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | Class B default | |
| 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | ||
| 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | ||
| 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | ||
| 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | ||
| 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | ||
| 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | Common cloud VPC subnet | |
| 255.255.254.0 | 0.0.1.255 | 512 | 510 | ||
| 255.255.255.0 | 0.0.0.255 | 256 | 254 | Class C default, typical LAN | |
| 255.255.255.128 | 0.0.0.127 | 128 | 126 | ||
| 255.255.255.192 | 0.0.0.63 | 64 | 62 | ||
| 255.255.255.224 | 0.0.0.31 | 32 | 30 | ||
| 255.255.255.240 | 0.0.0.15 | 16 | 14 | Small office or DMZ | |
| 255.255.255.248 | 0.0.0.7 | 8 | 6 | Common ISP static block | |
| 255.255.255.252 | 0.0.0.3 | 4 | 2 | Legacy point-to-point link | |
| 255.255.255.254 | 0.0.0.1 | 2 | 2 | Point-to-point (RFC 3021) | |
| 255.255.255.255 | 0.0.0.0 | 1 | 1 | Single host |
Private and Reserved IPv4 Address Ranges
The calculator labels each address by type. These are the ranges it recognizes, from the IANA IPv4 Special-Purpose Address Registry.
| Range | Purpose | Standard |
|---|---|---|
| 10.0.0.0/8 | Private network | RFC 1918 |
| 172.16.0.0/12 | Private network | RFC 1918 |
| 192.168.0.0/16 | Private network | RFC 1918 |
| 100.64.0.0/10 | Carrier-grade NAT | RFC 6598 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local (APIPA) | RFC 3927 |
| 198.18.0.0/15 | Benchmarking | RFC 2544 |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation and examples | RFC 5737 |
| 224.0.0.0/4 | Multicast | RFC 5771 |
| 240.0.0.0/4 | Reserved | RFC 1112 |
How to Find Your IPv4 Subnet Mask
- Windows: open Command Prompt and run
ipconfig. Look for "Subnet Mask" under your active adapter. - macOS: open System Settings, then Network, your connection, Details, TCP/IP. In Terminal,
ipconfig getoption en0 subnet_maskprints the same value. - Linux: run
ip addr. The address appears in CIDR form, such as192.168.1.23/24, and the number after the slash is the prefix length.
Paste the address and mask into the calculator to see the full subnet it belongs to.
IPv4 Subnets and Email Authentication
Subnetting is not only a network engineering task. If you send email, your SPF record lists the servers allowed to send on behalf of your domain, and it does that with ip4: mechanisms that accept CIDR ranges. ip4:203.0.113.0/24 authorizes all 256 addresses in that block.
A prefix that is too broad lets servers you do not control pass SPF for your domain. A prefix that is too narrow makes legitimate mail fail SPF, which then shows up as DMARC failures and, once you move to an enforcement policy, as rejected mail. For a public subnet the calculator shows the exact ip4: value to copy into your record, and the usable host range tells you precisely which addresses that mechanism covers. It warns about a block broader than a /16, and offers no value for private or reserved space or for anything broader than a /8.
ip4: range is resolved from the record itself, so replacing an include: with the ranges behind it is one way to stay under the limit.ip4: mechanism for them authorizes nothing and only adds noise to the record.More Free Network and Email Security Tools
WHOIS IP Lookup
See who an IP address block is allocated to.
Look up IP →PTR Record Lookup
Find the hostname an IP address points back to.
Check PTR →A Record Checker
See the IPv4 addresses a hostname points to.
Check A record →IP & Domain Blacklist Checker
See if an IP or domain is on a blocklist.
Check blocklists →SPF Record Checker
Validate your SPF record and every ip4 range in it.
Check SPF →SPF Record Generator
Build an SPF record that authorizes your IP ranges.
Generate SPF →Email Sender Reputation Checker
Check the reputation of a sending IP or domain.
Check sender →MX Record Lookup
Find the mail servers that receive a domain's email.
Check MX →IPv4 Subnet Calculator FAQ
What is an IPv4 subnet calculator?
How do you calculate IPv4 subnets?
What does /24 mean in an IP address?
How many hosts are in a /26 subnet?
What subnet mask do I need for 50 hosts?
What is a wildcard mask?
Why does a /31 subnet have 2 usable addresses?
Which IPv4 address ranges are private?
How do I use a subnet in an SPF record?
Authorizing IP ranges in SPF?
Validate your SPF record and check every ip4 range and lookup with PowerDMARC.