Quick answer
Enter an IPv4 address and a CIDR prefix and the calculator returns the network address, subnet and wildcard masks, broadcast address, first and last usable host and the number of usable hosts. The network address is the address AND the mask, the broadcast address is the network OR the inverted mask, and usable hosts are 2^(32 − prefix) − 2.
The prefix length is the number of leading bits that identify the network; the remaining bits identify hosts. This page handles IPv4 only; IPv6 uses a different address length and is not supported.
Related tools: Download Time Calculator: Time to download a file at a given speed. Bandwidth Calculator: Bandwidth needed to move a file in a given time. Data Transfer Calculator: Amount of data moved at a speed over a time.
How to use the IP Subnet Calculator
- Type iPv4 address, for example 192.168.1.130.
- Enter cIDR prefix length (a whole number, between 0 and 32). It starts at 24.
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| IPv4 address | Text, such as 192.168.1.130 | — |
| CIDR prefix length | A whole number | ≥ 0, ≤ 32, starts at 24 |
Formula and method
Formula
network = address AND mask; broadcast = network OR NOT mask; hosts = 2^(32 − prefix) − 2
IEEE-754 double precision; shown to at most 6 decimal places.
/31 (point-to-point, RFC 3021) has 2 usable hosts and /32 has 1.
Worked examples
These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.
Example 1
Inputs: IPv4 address = 192.168.1.130; CIDR prefix length = 26.
| Result | Value |
|---|---|
| Network | 192.168.1.128/26 |
| Subnet mask | 255.255.255.192 |
| Wildcard mask | 0.0.0.63 |
| Broadcast | 192.168.1.191 |
| First host | 192.168.1.129 |
| Last host | 192.168.1.190 |
| Usable hosts | 62 |
Example 2
Inputs: IPv4 address = 10.0.0.1; CIDR prefix length = 8.
| Result | Value |
|---|---|
| Network | 10.0.0.0/8 |
| Subnet mask | 255.0.0.0 |
| Wildcard mask | 0.255.255.255 |
| Broadcast | 10.255.255.255 |
| First host | 10.0.0.1 |
| Last host | 10.255.255.254 |
| Usable hosts | 16,777,214 |
Example 3
Inputs: IPv4 address = 10.1.1.1; CIDR prefix length = 32.
| Result | Value |
|---|---|
| Network | 10.1.1.1/32 |
| Subnet mask | 255.255.255.255 |
| Wildcard mask | 0.0.0.0 |
| Broadcast | 10.1.1.1 |
| First host | 10.1.1.1 |
| Last host | 10.1.1.1 |
| Usable hosts | 1 |
The first line is the headline result (network). Below it the iP Subnet Calculator lists subnet mask, wildcard mask, broadcast, first host, last host and usable hosts, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.
Reading the result
For 192.168.1.130/26 the mask is 255.255.255.192, so the block size is 64 and the address falls in the block 192.168.1.128 to 192.168.1.191. The network address is 192.168.1.128, the broadcast address 192.168.1.191 and the usable hosts run from .129 to .190: 64 − 2 = 62.
Two addresses in every ordinary subnet are reserved: the network address and the broadcast address. The exceptions are /31, which RFC 3021 allows for point-to-point links with 2 usable addresses, and /32, which is a single host.
Usable hosts by prefix length
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
Common mistakes
- Assigning the network or broadcast address to a device.
- Forgetting that the host count excludes those two addresses.
- Mixing up the subnet mask (ones for the network) with the wildcard mask (the inverse), which routers and access lists often use.
- Assuming 192.168.x.x, 10.x.x.x and 172.16-31.x.x are public: they are the private ranges in RFC 1918.
192.168.1.130 at different prefix lengths
Every figure in this table comes from running this calculator, so it matches what the form returns.
| Prefix | Network | Broadcast | Usable hosts |
|---|---|---|---|
| 24 | 192.168.1.0/24 | 192.168.1.255 | 254 |
| 25 | 192.168.1.128/25 | 192.168.1.255 | 126 |
| 26 | 192.168.1.128/26 | 192.168.1.191 | 62 |
| 27 | 192.168.1.128/27 | 192.168.1.159 | 30 |
| 28 | 192.168.1.128/28 | 192.168.1.143 | 14 |
What happens with invalid input
These messages are produced by the calculator itself, so you know what to fix.
- IPv4 address: entering "300.1.1.1" shows "Enter a valid IPv4 address such as 192.168.1.10." beside that field and no result.
- CIDR prefix length: entering "33" shows "CIDR prefix length must be at most 32." beside that field and no result.
Choosing between the IP Subnet Calculator and similar calculators
Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.
| Calculator | You enter | It returns |
|---|---|---|
| [Download Time Calculator](/technology/download-time-calculator/) | file size, size unit and connection speed | Time |
| [Bandwidth Calculator](/technology/bandwidth-calculator/) | data size, size unit and time allowed | Bandwidth required |
| [Data Transfer Calculator](/technology/data-transfer-calculator/) | speed, speed unit and duration | Data transferred |
| [Latency to Distance Calculator](/technology/latency-to-distance-calculator/) | round-trip latency and signal speed as a fraction of c | Approximate distance |
| [Network Throughput Calculator](/technology/network-throughput-calculator/) | tCP window size and round-trip time | Maximum throughput |
Background: networking and display
Network speeds are quoted in bits per second and file sizes in bytes, and a byte is 8 bits, so a 100 Mbps link moves at most 12.5 megabytes per second; real throughput is usually below the advertised rate. Pixel density is the diagonal in pixels divided by the diagonal in inches: a 1920×1080 display of 24 inches is about 92 pixels per inch, and a 3840×2160 display of 27 inches about 163.
Assumptions and limitations
- Prefix 0–32
- Octets 0–255
If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for iPv4 address and cIDR prefix length to confirm this.
Frequently asked questions
Why are two addresses subtracted from the host count?
The first address of a subnet is the network address and the last is the broadcast address; neither can be assigned to a device, so usable hosts are 2^(32 − prefix) − 2.
Does this calculator support IPv6?
No. It works on IPv4 addresses with prefixes from 0 to 32.
What does the IP Subnet Calculator calculate?
IPv4 network, broadcast, mask and host range from an address and CIDR prefix. It returns Network, Subnet mask, Wildcard mask, Broadcast and First host.
What formula does the IP Subnet Calculator use?
network = address AND mask; broadcast = network OR NOT mask; hosts = 2^(32 − prefix) − 2. /31 (point-to-point, RFC 3021) has 2 usable hosts and /32 has 1.
What do I need to enter in the iP Subnet Calculator?
You enter IPv4 address and CIDR prefix length.
How is the result rounded or limited?
IEEE-754 double precision; shown to at most 6 decimal places. Prefix 0–32.
What are the limits of this calculator?
Prefix 0–32. Octets 0–255.
What is an example of a iP Subnet result?
With iPv4 address 192.168.1.130 and cIDR prefix length 26, the network is 192.168.1.128/26.
Where does the method come from?
The method follows: RFC 4632 (CIDR); RFC 3021 (/31 networks).
Related calculators
- Download Time Calculator — Time to download a file at a given speed.
- Bandwidth Calculator — Bandwidth needed to move a file in a given time.
- Data Transfer Calculator — Amount of data moved at a speed over a time.
- Latency to Distance Calculator — Approximate one-way distance from round-trip latency.
- Network Throughput Calculator — Maximum TCP throughput from window size and round-trip time.
- Packet Loss Calculator — Percentage of packets lost.
Sources
- RFC 4632 (CIDR)
- RFC 3021 (/31 networks)
Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.