IP Subnet Calculator

Calculate subnet mask, network address, broadcast address, and host range from any IP address and CIDR notation.
Essential for network administrators.

Subnet Details

What subnetting does

Subnetting splits one large network into smaller ones, each with its own block of addresses. An IPv4 (Internet Protocol version 4) address is 32 bits, written as four octets such as 192.168.1.100, and every octet runs 0 to 255. Those 32 bits are cut into a network portion, which says which network you are on, and a host portion, which says which machine you are on it. The only question subnetting ever asks is where to put that cut.

CIDR notation

CIDR (Classless Inter-Domain Routing) writes the cut as a slash and a number: 192.168.1.0/24. The number counts the network bits, so /24 leaves 8 host bits, which is 2⁸ = 256 addresses. Two of those are spoken for, giving 254 usable hosts.

The mask is the same information in dotted form, with a 1 for every network bit and a 0 for every host bit. A /24 is 255.255.255.0, a /16 is 255.255.0.0. Applying the mask to an address with a bitwise AND is what produces the network address.

The four addresses that matter

  • Network address is every host bit set to 0. It names the subnet and is not assigned to a machine.
  • Broadcast address is every host bit set to 1. Traffic sent here reaches every host on the subnet.
  • First usable host is the network address plus 1.
  • Last usable host is the broadcast address minus 1.

So usable hosts = 2^(host bits) − 2, and that subtraction of 2 is where the network and broadcast addresses go.

A worked example: 192.168.1.100/26

A /26 leaves 6 host bits, so each subnet holds 64 addresses and the mask is 255.255.255.192.

  • 192.168.1.100 in binary is 11000000.10101000.00000001.01100100
  • The mask keeps the first 26 bits, zeroing the last 6: ...01000000, which is 192.168.1.64
  • Broadcast is the same network with those 6 bits set: ...01111111, or 192.168.1.127
  • Usable range is 192.168.1.65 through 192.168.1.126, which is 62 hosts

That address sits in the second of four /26 blocks carved out of 192.168.1.0/24: .0, .64, .128 and .192.

Common sizes

Prefix Addresses Usable hosts Typical use
/32 1 1 a single host, or a firewall rule
/31 2 2 point-to-point links, under RFC 3021
/30 4 2 the traditional point-to-point link
/29 8 6 a handful of servers
/24 256 254 a typical office network
/16 65,536 65,534 a large site
/8 16,777,216 16,777,214 an entire private range

A note on /31: this calculator reports 0 usable hosts because that is what the classic 2^n − 2 rule gives. RFC 3021 later carved out an exception so that both addresses in a /31 can be used on a point-to-point link, where there is nothing to broadcast to. Most modern routers accept it, so treat the 0 as the conservative textbook answer rather than a hard limit.

IP classes, and why they are history

Before CIDR arrived in 1993, the first octet decided the split for you:

Class First octet Old default
A 0 to 127 /8
B 128 to 191 /16
C 192 to 223 /24
D 224 to 239 multicast
E 240 to 255 reserved

This calculator still reports the class because plenty of documentation and certification exams refer to it, but no router has honoured it for thirty years. The prefix you supply is what actually determines the network, and a 10.x address on a /24 is perfectly normal despite 10 being “class A”.

Private ranges (RFC 1918)

  • 10.0.0.0/8, covering 10.0.0.0 to 10.255.255.255
  • 172.16.0.0/12, covering 172.16.0.0 to 172.31.255.255
  • 192.168.0.0/16, covering 192.168.0.0 to 192.168.255.255

These are reserved for internal use and never routed across the public internet. The 172.16 range is the one people get wrong: it stops at 172.31, not 172.16.255.255, so 172.20.0.5 is private but 172.32.0.5 is not.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.