Technology calculators

IPv4 Subnet Calculator

Updated Sep 5, 2026 By Jehan Wadia
Rate Formulas
Subnet Inputs
Four octets, 0–255, separated by dots.
IP Class Filter
Any: prefixes /1–/32 available.
Mask and prefix stay in sync with the two menus at right.
Pick a host count to jump to the matching mask.
Subnets of this size inside the parent block.
Subnet Results
IP Address Representations
Binary Breakdown of the Address

Network bits (24) Host bits (8)
Address Bit Allocation
Step-by-Step Solution
All Possible Subnets
All subnets of the selected size.
Network Address Usable Host Range Broadcast Address
Subnet Details — Entered Network Block
Subnets within the entered network block.
Subnet # Network Address Usable Host Range Broadcast Address Subnet Mask CIDR

Introduction

This IPv4 Subnet Calculator splits an IP network into smaller parts called subnets. Type an IP address, pick a subnet mask or CIDR prefix, and you get the full breakdown of that block.

You get the network address, broadcast address, usable host range, wildcard mask, and the number of hosts and subnets. You also see the IP in binary, hex, and integer form, plus its class and type (public or private).

The color-coded binary view shows which bits are network bits and which are host bits. A step-by-step section shows how each answer was found, so you can learn the method and not just copy the result. Two tables list every subnet in the block, with your subnet highlighted.

Network admins, students, and anyone studying for CCNA or Network+ can use this tool to plan IP ranges fast and check their work.

How to use our IPv4 Subnet Calculator

Type an IPv4 address and pick a subnet mask. The calculator shows the network address, usable host range, broadcast address, wildcard mask, host counts, binary breakdown, step-by-step math, and full subnet tables.

IPv4 Address: Enter the IP you want to check, like 142.93.55.87. Use four numbers from 0 to 255, split by dots.

IP Class Filter: Choose Any, A, B, or C. This sets which prefix lengths show up in the mask list. Any gives you /1 to /32.

Subnet Mask & CIDR: Pick a mask such as 255.255.255.0. The box next to it shows the matching CIDR prefix, like /24.

Hosts per Subnet: Pick how many usable hosts you need. The mask and CIDR change to match your pick.

Number of Subnets: Pick how many subnets you want inside the parent block. The mask and host count update to match.

Calculate: Click this button to see your results, charts, and subnet tables.

Clear: Click this to reset the IP, class, and mask back to the default values.

What Is IPv4 Subnetting?

An IPv4 address is the number that names a device on a network, like 142.93.55.87. It has four parts called octets, and each octet is a number from 0 to 255. Behind the scenes, the whole address is just 32 ones and zeros.

Subnetting means splitting one big block of IP addresses into smaller blocks. Each smaller block is a subnet. Networks are split this way to save addresses, cut down on extra traffic, and keep groups of devices apart for better speed and safety.

The Subnet Mask and CIDR

A subnet mask tells you which bits of the address name the network and which bits name the host (the device). Network bits come first and are always the 1 bits in the mask. Host bits come last.

CIDR notation is a short way to write the same thing. A slash and a number, like /24, means "the first 24 bits are network bits." So 255.255.255.0 and /24 mean exactly the same thing.

Key Parts of Every Subnet

  • Network address: the first address in the block. All host bits are 0. It names the subnet and is not given to a device.
  • Broadcast address: the last address in the block. All host bits are 1. Data sent here goes to every device in the subnet.
  • Usable host range: all the addresses in between. These are the ones you can hand out to computers, phones, printers, and routers.
  • Wildcard mask: the flipped version of the subnet mask. Cisco routers use it in access lists and OSPF setups.

How the Math Works

A subnet has 2(32 − prefix) total addresses. A /24 has 28 = 256 addresses. Take away the network address and the broadcast address, and you get 254 usable hosts. Two special cases break this rule: a /31 gives you 2 usable addresses for point-to-point links (RFC 3021), and a /32 is a single host.

Common Subnet Sizes

CIDRSubnet MaskTotal AddressesUsable Hosts
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/26255.255.255.1926462
/24255.255.255.0256254
/16255.255.0.065,53665,534
/8255.0.0.016,777,21616,777,214

IP Classes

Older networks used classes based on the first octet. Class A runs 0 to 127 with a natural /8 mask. Class B runs 128 to 191 with a /16. Class C runs 192 to 223 with a /24. Class D (224 to 239) is for multicast and Class E (240 to 255) is reserved. Modern networks use CIDR instead, but classes still help you understand address ranges and older gear.

Private vs. Public Addresses

Public addresses work on the open Internet. Private addresses only work inside your own network and must pass through NAT to reach the Internet. The private ranges (RFC 1918) are:

  • 10.0.0.0 to 10.255.255.255 (10.0.0.0/8)
  • 172.16.0.0 to 172.31.255.255 (172.16.0.0/12)
  • 192.168.0.0 to 192.168.255.255 (192.168.0.0/16)

Other special ranges include 127.0.0.0/8 for loopback and 169.254.0.0/16 for link-local (APIPA) addresses that show up when DHCP fails.

Other Ways to Write an IP

The same address can be shown as binary, as one big integer, in hex, as a reverse-DNS name ending in .in-addr.arpa, or mapped into IPv6 with the ::ffff: prefix. These forms show up in logs, packet captures, and config files, so it helps to recognize them.


Formulas used

IP address as 32-bit integer
I = o_1 \cdot 2^{24} + o_2 \cdot 2^{16} + o_3 \cdot 2^{8} + o_4
Subnet mask value from prefix length
M = 2^{32} - 2^{32-p}
Wildcard mask
W = (2^{32} - 1) - M
Block size (total addresses per subnet)
B = 2^{32-p}
Network address
N = \left\lfloor \frac{I}{B} \right\rfloor \cdot B
Broadcast address
A_{broadcast} = N + B - 1
Usable hosts per subnet
H = \begin{cases} 2^{32-p} - 2, & p \le 30 \\ 2, & p = 31 \\ 1, & p = 32 \end{cases}
Number of subnets inside the parent block
S = 2^{\,p - p_{parent}}

Frequently asked questions

How do I find the subnet mask on my computer?

On Windows, open Command Prompt and type ipconfig. Look for the line that says Subnet Mask. On a Mac, go to System Settings, then Network, then Details, then TCP/IP. On Linux, type ip addr in a terminal; the number after the slash, like /24, is the prefix.

Most home networks show 255.255.255.0.

How can I tell if two IP addresses are on the same subnet?

Apply the same subnet mask to both addresses. If both give the same network address, they are on the same subnet.

Example with mask 255.255.255.0: 192.168.1.10 and 192.168.1.200 both land on network 192.168.1.0, so they match. But 192.168.2.10 lands on 192.168.2.0, so it is on a different subnet and needs a router to be reached.

How do devices on different subnets talk to each other?

They send traffic through a router. A device checks the destination IP against its own subnet mask. If the address is outside its subnet, it hands the packet to its default gateway, which is the router. The router then forwards it toward the right network.

Without a router, two subnets cannot reach each other, even on the same cable or switch.

Does the default gateway have to be in the same subnet?

Yes. The gateway must be a usable address inside the same subnet as the device, or the device cannot reach it.

If your PC is 192.168.1.50 with mask 255.255.255.0, the gateway must be something like 192.168.1.1. Setting it to 192.168.2.1 breaks Internet access.

What is VLSM in subnetting?

VLSM means Variable Length Subnet Mask. It lets you use different subnet sizes inside one network instead of splitting everything into equal parts.

For example, a big office LAN can get a /24 with 254 hosts, while a router-to-router link only gets a /30 with 2 hosts. This stops you from wasting hundreds of addresses on a link that needs two.

What is the difference between a subnet and a VLAN?

A subnet is a Layer 3 idea. It is a range of IP addresses. A VLAN is a Layer 2 idea. It splits a switch into separate broadcast groups.

In practice they are paired: each VLAN usually gets its own subnet. The VLAN keeps the traffic apart on the switch, and the subnet gives that group its own IP range.

Can two devices have the same IP address on different networks?

Yes, if the networks are separate and private. Millions of homes use 192.168.1.10 at the same time because private addresses are not routed on the Internet; NAT hides them behind one public IP.

But two devices on the same subnet can never share an IP. That causes an address conflict and both devices lose connection.

Why can't a subnet mask have gaps in it?

A valid mask is a solid run of 1s followed by a solid run of 0s, like 11111111.11111111.11111111.00000000. Routers read the mask as "how many bits at the front are the network," so a split mask such as 255.0.255.0 has no meaning and gear will reject it.

This is why only 255, 254, 252, 248, 240, 224, 192, 128, and 0 show up in real masks.

Does subnetting make a network faster?

It can help. Smaller subnets mean smaller broadcast domains, so devices get flooded with fewer broadcast messages and waste less time on traffic that is not for them.

It does not raise your Internet speed. The gain shows up on busy local networks with many devices, and it also improves security by keeping groups apart.

How many subnets can a /24 be split into?

It depends on the new prefix. Each extra bit you borrow doubles the count:

  • /25 = 2 subnets of 126 hosts
  • /26 = 4 subnets of 62 hosts
  • /27 = 8 subnets of 30 hosts
  • /28 = 16 subnets of 14 hosts
  • /29 = 32 subnets of 6 hosts
  • /30 = 64 subnets of 2 hosts

The formula is 2 to the power of the borrowed bits.

What subnet mask should I use for a home network?

255.255.255.0 (/24) works for almost every home. It gives 254 usable addresses, which is far more than most houses need.

If you want tighter control, a /25 gives 126 hosts and a /26 gives 62. Just make sure your router's DHCP range sits inside the subnet you pick.

What does 0.0.0.0/0 mean?

It means "every possible IPv4 address." A /0 prefix has zero network bits, so it matches all 4.3 billion addresses.

Routers use it as the default route: if no other route matches a packet, send it here. On a firewall rule, 0.0.0.0/0 means "any source" or "any destination."

What is supernetting?

Supernetting is the opposite of subnetting. You join several small networks into one bigger block by moving the prefix to the left.

For example, 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, and 192.168.3.0/24 all fit inside 192.168.0.0/22. Routers then carry one route instead of four, which keeps routing tables small.

Why does my device get a 169.254 address?

That is an APIPA or link-local address. Your device asked a DHCP server for an IP, got no answer, and gave itself one from 169.254.0.0/16.

It means something is broken: an unplugged cable, a down router, or a DHCP server that is off or out of addresses. Devices with these addresses can only reach others on the same wire, not the Internet.