Technology calculators

IPv4 Subnet Calculator

Updated Oct 8, 2026 By Infinity Calculator
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.6 Behind the scenes, the whole address is just 32 ones and zeros.6

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).3 Network bits come first and are always the 1 bits in the mask.1 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.1 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.2
  • Broadcast address: the last address in the block. All host bits are 1. Data sent here goes to every device in the subnet.2
  • 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.8 Cisco's OSPF network command uses one too, to define the interfaces that run OSPF.13

How the Math Works

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

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. The class is set by the first bits of the address.6 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, from 224.0.0.0 to 239.255.255.255, is for multicast.7 Class E, 240.0.0.0/4, is reserved.9 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 are for use inside a network and are not routed on the Internet.4 To reach the Internet, their traffic usually passes through NAT. RFC 1918 sets aside three private ranges.4 They 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.9 A device gives itself a link-local address when it cannot get one from a DHCP server.10

Other Ways to Write an IP

The same address can be shown as binary, as one big integer, or in hex. For reverse DNS, the octets are written in reverse order in front of .in-addr.arpa.11 In IPv6, an IPv4-mapped address puts the IPv4 address after the ::ffff: prefix.12 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 1
M = 2^{32} - 2^{32-p}
Wildcard mask
W = (2^{32} - 1) - M
Block size (total addresses per subnet) 1
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 1
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.

Many 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.2

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.2 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. A host sends a datagram for another network to a gateway on a connected network.2

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. Many homes use 192.168.1.10 at the same time. Private addresses can be reused by many networks because they are not routed on the Internet.4 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. CIDR writes a mask as a prefix length, the number of 1 bits at the front, so a mask with gaps cannot be written that way.1 255.0.255.0 is an example of a mask with gaps. The original 1985 subnetting standard allowed gaps but recommended keeping the subnet bits together.3 Modern routers and operating systems expect a solid mask.

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.1 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.1

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.10

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.10


Sources

  1. Fuller V, Li T. Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan (RFC 4632). Internet Engineering Task Force. 2006;§ 2 History; § 3.1 Prefix Notation (prefix table); § 4 Aggregation; § 5 Routing Implementation. Accessed September 29, 2026.
  2. Braden R, ed.. Requirements for Internet Hosts -- Communication Layers (RFC 1122). Internet Engineering Task Force. 1989;§ 3.2.1.3 Addressing; § 3.3.1.1 Local/Remote Decision; § 3.3.6 Broadcasts. Accessed September 29, 2026.
  3. Mogul J, Postel J. Internet Standard Subnetting Procedure (RFC 950). Internet Engineering Task Force. 1985;§ 2.1 Interpretation of Internet Addresses; § 2.2 Changes to Host Software. Accessed September 29, 2026.
  4. Rekhter Y, Moskowitz B, Karrenberg D, de Groot GJ, Lear E. Address Allocation for Private Internets (RFC 1918). Internet Engineering Task Force. 1996;§ 3 Private Address Space. Accessed September 29, 2026.
  5. Retana A, White R, Fuller V, McPherson D. Using 31-Bit Prefixes on IPv4 Point-to-Point Links (RFC 3021). Internet Engineering Task Force. 2000;§ 1 Introduction; § 2.1 Addressing. Accessed September 29, 2026.
  6. Postel J, ed.. Internet Protocol (RFC 791). Internet Engineering Task Force. 1981;§ 2.3 Addressing. Accessed September 29, 2026.
  7. Deering S. Host Extensions for IP Multicasting (RFC 1112). Internet Engineering Task Force. 1989;§ 4 Host Group Addresses. Accessed September 29, 2026.
  8. Configure IP Access Lists. Cisco Systems. 2025;ACL Basics: wildcard (inverse) masks. Accessed September 29, 2026.
  9. Cotton M, Vegoda L, Bonica R, ed., Haberman B. Special-Purpose IP Address Registries (RFC 6890). Internet Engineering Task Force. 2013;§ 2.2.2 IPv4 Special-Purpose Address Registry entries. Accessed September 29, 2026.
  10. Cheshire S, Aboba B, Guttman E. Dynamic Configuration of IPv4 Link-Local Addresses (RFC 3927). Internet Engineering Task Force. 2005;§ 1 Introduction; § 2.7 Link-Local Packets Are Not Forwarded. Accessed September 29, 2026.
  11. Mockapetris P. Domain Names - Implementation and Specification (RFC 1035). Internet Engineering Task Force. 1987;§ 3.5 IN-ADDR.ARPA domain. Accessed September 29, 2026.
  12. Hinden R, Deering S. IP Version 6 Addressing Architecture (RFC 4291). Internet Engineering Task Force. 2006;§ 2.2 Text Representation; § 2.5.1 Interface Identifiers; § 2.5.5.2 IPv4-Mapped IPv6 Address. Accessed September 29, 2026.
  13. IP Routing: OSPF Configuration Guide, Cisco IOS XE 16: Configuring OSPF. Cisco Systems. 2026;Enabling OSPF, step 4. Accessed October 7, 2026.