Skip to main content
other

IP Subnet Calculator

Find the network and broadcast addresses, usable host range, host count and subnet and wildcard masks of an IPv4 address with a CIDR prefix or subnet mask, including /31 and /32

By Christopher FloiedPublished Updated

IPv4 Subnet from an Address and a Prefix or Mask

Enter an IPv4 address with its CIDR prefix, either as 192.168.1.130/24 or as the address and the prefix length (24) or subnet mask (255.255.255.0) in the second field. The calculator gives the subnet the address belongs to: its network and broadcast addresses, usable host range and counts, and the subnet and wildcard masks.

Load a worked example:

Like 192.168.1.130, or 192.168.1.130/24

A whole number from 0 to 32 (or /24), or a mask like 255.255.255.0

Network address
192.168.1.0
Broadcast address
192.168.1.255
Usable host range
192.168.1.1 – 192.168.1.254
Usable hosts
254
Total addresses
256
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
CIDR notation
192.168.1.0/24
Host bits
8

Network 192.168.1.0/24, 254 usable hosts.

Common prefix lengths
PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the IP Subnet Calculator. Follow the units and input format printed next to each field. Where a unit selector is available, choose the units that match your data.

2

Review your inputs

Double-check that all values are correct and match the units or format shown for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The IP Subnet Calculator computes the output in your browser and displays the results, with units clearly labeled, as soon as they are ready — no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Network, Broadcast and Wildcard

network = address AND mask | broadcast = network OR wildcard | wildcard = NOT mask

Variables: address, mask = 32-bit numbers written as four octets (192.168.1.130, 255.255.255.0); the mask has prefix leading 1 bits (/24 = 255.255.255.0); AND, OR and NOT act bit by bit on unsigned 32-bit values. Source: RFC 950 (Internet Standard Subnetting Procedure) and RFC 4632 (CIDR)

Subnet Size and Usable Hosts

total = 2^(32 − prefix) | usable = total − 2 for /0 to /30, 2 for /31, 1 for /32

Variables: prefix = CIDR prefix length, 0 to 32. Up to /30 the network and broadcast addresses are reserved; a /31 uses both of its addresses on a point-to-point link (RFC 3021); a /32 is a single host. Counts are exact integers: a /0 has 4,294,967,296 addresses

Usable Host Range

first = network + 1, last = broadcast − 1 (/0 to /30) | /31: network to broadcast | /32: the address itself

Variables: network, broadcast = the subnet's first and last addresses from the formula above. 192.168.1.130/24 gives 192.168.1.1 to 192.168.1.254

When to Use This Calculator

  • •Use the IP Subnet Calculator when you need accurate results quickly without the risk of manual computation errors or unit conversion mistakes.
  • •Use it to verify calculations made by hand or in spreadsheets — an independent check can catch errors before they lead to costly decisions.
  • •Use it to explore how changing input parameters affects the output — a quick way to develop intuition and identify the most influential variables.
  • •Use it when collaborating with others to ensure everyone is working from the same numbers and applying the same assumptions.

About This Calculator

The IP Subnet Calculator is a free, browser-based calculation tool for engineers, students, and technical professionals. Find the network and broadcast addresses, usable host range, host count and subnet and wildcard masks of an IPv4 address with a CIDR prefix or subnet mask, including /31 and /32 It implements standard formulas. Follow the units shown beside each field and use unit selectors where available. All calculations are performed in your browser with no data sent to a server. Use this calculator as a quick reference and sanity-check tool during design, analysis, and learning. Always verify results against primary engineering references and applicable standards for any safety-critical application.

The Theory Behind It

An IPv4 address is a 32-bit number, written as four decimal octets from 0 to 255 separated by dots, such as 192.168.1.130. A subnet splits those 32 bits into a network part and a host part. The prefix length in CIDR notation, the /24 in 192.168.1.130/24, is the number of leading bits that belong to the network. The subnet mask writes the same thing as an address whose first 24 bits are 1: 255.255.255.0. So /24 and 255.255.255.0 mean the same thing. The wildcard mask is the mask inverted, 0.0.0.255, the form access control lists and some routing configurations use. Three bit operations give everything else. The network address is the address AND the mask, with every host bit set to 0: 192.168.1.0. The broadcast address is the network address OR the wildcard mask, with every host bit set to 1: 192.168.1.255. The subnet holds 2^(32 − prefix) addresses, 256 for a /24. For prefixes up to /30 (/31 and /32 are the exceptions below), the network and broadcast addresses are reserved, so the usable hosts run from the network address plus one to the broadcast address minus one, and there are 2^(32 − prefix) − 2 of them: 192.168.1.1 to 192.168.1.254, 254 hosts. Two prefixes are different. A /31 has only two addresses, and reserving both would leave none, so RFC 3021 lets a point-to-point link use both, with no network or broadcast address: 10.0.0.0/31 has the usable addresses 10.0.0.0 and 10.0.0.1. A /32 is a single address, used for loopback interfaces and host routes. At the other end, /0 covers the whole IPv4 address space. Common subnet sizes include /8 (16,777,216 addresses, 16,777,214 usable), /16 (65,536 addresses, 65,534 usable), /24 (256 addresses, 254 usable), the usual size for a local network, and /30 (4 addresses, 2 usable), the traditional size for a link between two routers before /31 became common. Variable-length subnet masking (VLSM) lets one network use different sizes side by side, such as a /24 for a server VLAN and a /31 for a router link. This calculator reads the address strictly: four numbers from 0 to 255 and nothing else. It refuses 256.1.2.3 or 1.2.3 rather than guessing what was meant, and it refuses leading zeros, because some software reads 010 as the octal number 8. It does the bit arithmetic on unsigned 32-bit numbers and counts addresses with integers that cannot overflow, so a /0 shows its 4,294,967,296 addresses exactly.

Real-World Applications

  • •Planning an office or VLAN address plan: see how many hosts a /24, /25 or /26 leaves and where each subnet starts and ends before assigning DHCP ranges.
  • •Configuring a router or firewall: interface, route and access-list statements ask for the network address and the subnet mask or, in many access lists, the wildcard mask.
  • •Troubleshooting connectivity: two devices reach each other without a router only if they are in the same subnet. Enter each address with its mask and compare the network addresses.
  • •Point-to-point links between routers: a /31 uses both of its addresses (RFC 3021), where a /30 spends two of its four on the network and broadcast addresses.
  • •Studying for networking exams: the worked examples and the prefix table cover the counts, masks and special cases that subnetting questions turn on.

Frequently Asked Questions

What does this subnet calculator need?

An IPv4 address and its prefix. Type them together as 192.168.1.130/24, or type the address in the first field and the prefix length (24 or /24) or the subnet mask (255.255.255.0) in the second. The address must be four numbers from 0 to 255 separated by dots.

What is the difference between /24 and 255.255.255.0?

None: /24 is CIDR notation for 24 network bits, and 255.255.255.0 is the same mask written as a dotted address. Both leave 8 bits for hosts, so the subnet has 256 addresses, 254 of them usable.

What is the most common subnet size?

The /24 (256 addresses, 254 usable) is the most widely used size for local area networks. It gives enough addresses for most small and medium networks while keeping the broadcast domain manageable.

Why does a /31 have two usable hosts?

A /31 has only two addresses. With the usual rule both would be reserved as the network and broadcast addresses, leaving no host. RFC 3021 lets a point-to-point link, which has exactly two ends and needs no broadcast, use both addresses as hosts, so the calculator gives a /31 two usable hosts and no broadcast address.

What is a wildcard mask?

The subnet mask with every bit inverted: 255.255.255.0 becomes 0.0.0.255. A 0 bit means the address bit must match and a 1 bit means it can be anything. Access control lists and some routing configurations, such as Cisco's, are written with wildcard masks.

Why is an address like 010.0.0.1 refused?

Some software reads a number with a leading zero as octal, so 010 can mean 8 rather than 10. To avoid computing the wrong subnet, the calculator asks for each part without leading zeros, as Python's ipaddress module does.

Worked Examples

Example 1: An office computer: 192.168.1.130/24

A computer has the address 192.168.1.130 with the prefix /24. Find the subnet it belongs to.

Step 1:/24 means 24 network bits, so the mask is 255.255.255.0 and 32 − 24 = 8 host bits remain.
Step 2:Set the 8 host bits to 0: the network address 192.168.1.0.
Step 3:Set them to 1: the broadcast address 192.168.1.255.
Step 4:The usable hosts run from 192.168.1.1 to 192.168.1.254: 2^8 = 256 addresses, and 256 − 2 = 254 hosts.

Network 192.168.1.0, broadcast 192.168.1.255, hosts 192.168.1.1–192.168.1.254 (254 usable), mask 255.255.255.0, wildcard 0.0.0.255.

Example 2: A link between two routers: 10.0.0.0/31

Two routers share the point-to-point link 10.0.0.0/31.

Step 1:/31 leaves one host bit: the mask is 255.255.255.254 and the subnet has 2 addresses.
Step 2:The usual rule would reserve both and leave no host, so RFC 3021 makes both usable on a point-to-point link: 10.0.0.0 and 10.0.0.1.
Step 3:There is no broadcast address; the calculator shows 10.0.0.1 as the last address.

2 usable addresses, 10.0.0.0 and 10.0.0.1. A /30 would have spent half of its four addresses on the network and broadcast addresses.

Example 3: A single host: 10.0.0.1/32

A loopback interface or host route uses 10.0.0.1/32.

Step 1:/32 leaves no host bits: the mask is 255.255.255.255 and the subnet has 1 address.
Step 2:That address is the network, the first and last address and the only host.

Network 10.0.0.1, with 1 usable address and no broadcast address.

Example 4: The whole address space: 1.2.3.4/0

With /0 any address gives the same subnet; enter 1.2.3.4/0.

Step 1:/0 leaves all 32 bits for hosts: 2^32 = 4,294,967,296 addresses.
Step 2:Every bit of the network address is 0 and every bit of the broadcast address is 1: network 0.0.0.0, broadcast 255.255.255.255.

4,294,967,294 usable addresses, 0.0.0.1 to 255.255.255.254, counted exactly.

Common Mistakes & Tips

  • !Forgetting the two reserved addresses: up to /30 the network and broadcast addresses are not usable hosts, so a /24 has 254 hosts, not 256. A /31 (RFC 3021) and a /32 are the exceptions.
  • !Confusing the prefix length with the number of host bits. They add up to 32, so a /26 leaves 6 host bits: 64 addresses.
  • !Not planning for growth: a subnet sized exactly for today's devices leaves no room. Allocate one at least twice as large as you need now.
  • !Writing octets with leading zeros, such as 192.168.001.010: some software reads 010 as octal 8, so the calculator refuses it.
  • !Using a mask with a gap, such as 255.0.255.0: a subnet mask's 1 bits must all come first.
  • !Mixing up the subnet mask and the wildcard mask in an access list: the wildcard 0.0.0.255 is the mask 255.255.255.0 inverted.

Related Concepts

Related Calculators

References & Further Reading

Add the live IP Subnet Calculator to your site. Free to embed, with a link back to MegaCalc.