IP Subnet Calculator (IPv4)

Enter an IPv4 address and prefix to get the network and broadcast addresses, host range, host count, subnet and wildcard masks, binary view and smaller subnets.

You can also type CIDR notation (172.16.5.4/20) or an address followed by a mask (172.16.5.4 255.255.240.0); that prefix then overrides the menu below.
Network address
192.168.1.128
Broadcast address
192.168.1.191
Usable host range
192.168.1.129 – 192.168.1.190
Usable hosts
6264 addresses in total
Subnet mask
255.255.255.192
Wildcard mask
0.0.0.63inverse mask, used in ACLs and OSPF
Address type
Private network (RFC 1918)
Legacy class
C
As a 32-bit integer
3,232,235,906hex 0xC0A80182
192.168.1.130/26 belongs to192.168.1.128/2662 usable hosts · mask 255.255.255.192

Show the work

  1. A /26 prefix means the first 26 bits are the network part and the last 6 bits identify hosts.
  2. Subnet mask = 26 ones followed by 6 zeros = 255.255.255.192
  3. Network = address AND mask = 192.168.1.130 AND 255.255.255.192 = 192.168.1.128
  4. Broadcast = network OR wildcard = 192.168.1.128 OR 0.0.0.63 = 192.168.1.191
  5. Usable hosts = 26 − 2 = 64 − 2 = 62

Binary view

RowBits (network part highlighted)Dotted decimal
Address11000000.10101000.00000001.10000010192.168.1.130
Subnet mask11111111.11111111.11111111.11000000255.255.255.192
Wildcard00000000.00000000.00000000.001111110.0.0.63
Network11000000.10101000.00000001.10000000192.168.1.128
Broadcast11000000.10101000.00000001.10111111192.168.1.191
Ways to divide 192.168.1.128/26
PrefixMaskSubnetsHosts each
/27255.255.255.224230
/28255.255.255.240414
/29255.255.255.24886
/30255.255.255.252162
/31255.255.255.254322
/32255.255.255.255641

Every IPv4 network is described by an address and a prefix length — 192.168.1.130/26, for example. From those two numbers come everything an administrator needs: which subnet the address belongs to, where that subnet starts and ends, which addresses can be given to hosts, and what mask to type into a router or firewall. This calculator does the bit arithmetic and shows it in binary so you can see why the boundaries fall where they do.

How to use the subnet calculator

  1. Type an IP address. You can also paste CIDR notation such as 10.20.30.40/22, or an address followed by a dotted mask such as 172.16.5.4 255.255.240.0 — the prefix in the field then wins over the menu.
  2. Otherwise, pick the prefix length / subnet mask from the list; each option shows the dotted mask and host count.
  3. Read the network, broadcast, host range, mask and wildcard on the tape, along with the address type (private, public, loopback …) and the reverse-DNS zone for octet-aligned prefixes.
  4. Optionally choose List smaller subnets to break the network into equal subnets, for example a /20 into sixteen /24s.

Subnet formulas

An IPv4 address is a 32-bit number. A /p prefix means the first p bits identify the network and the remaining 32 − p bits identify hosts.

mask = p ones followed by (32 − p) zeros  ·  wildcard = NOT mask
network = address AND mask  ·  broadcast = network OR wildcard
usable hosts = 232 − p − 2  (for p ≤ 30)

Two cases break the “minus 2” rule: a /31 has two usable addresses on point-to-point links (RFC 3021), and a /32 is a single host.

Worked example

Find the subnet for 192.168.1.130/26.

Mask: 26 ones = 11111111.11111111.11111111.11000000 = 255.255.255.192. The last octet has 2 network bits and 6 host bits, so each subnet spans 2⁶ = 64 addresses.

Network: 130 in binary is 10000010. AND with 11000000 gives 10000000 = 128, so the network is 192.168.1.128.

Broadcast: set the 6 host bits to 1: 10111111 = 191, so 192.168.1.191.

Hosts: 192.168.1.129 through 192.168.1.190 — 64 − 2 = 62 usable addresses. Wildcard mask 0.0.0.63.

A quicker mental method: the “block size” is 256 minus the interesting mask octet (256 − 192 = 64). Subnets start at multiples of 64 — 0, 64, 128, 192 — and 130 falls in the block that starts at 128.

Common prefixes

Prefix Mask Addresses Usable hosts
/8 255.0.0.0 16,777,216 16,777,214
/16 255.255.0.0 65,536 65,534
/22 255.255.252.0 1,024 1,022
/24 255.255.255.0 256 254
/26 255.255.255.192 64 62
/28 255.255.255.240 16 14
/30 255.255.255.252 4 2
/31 255.255.255.254 2 2 (point-to-point)
/32 255.255.255.255 1 1

Planning tips

  • Size for growth. A subnet cannot easily be widened later without renumbering. If a VLAN will hold 100 devices today, a /25 (126 hosts) is tight; a /24 leaves room.
  • Align on boundaries. A /22 must start at a third octet divisible by 4 (0, 4, 8 …). The calculator always reports the aligned network that contains your address.
  • Reserve addresses for gateways, printers and DHCP exclusions; a common habit is to give the router the first usable address.
  • Cloud networks reserve extra addresses. Major cloud providers hold back several addresses in every subnet, so a /28 there may offer only 11 usable hosts.

The tool understands the IANA special-purpose ranges, so it flags loopback (127.0.0.0/8), link-local (169.254.0.0/16), carrier-grade NAT (100.64.0.0/10), documentation ranges such as 192.0.2.0/24, multicast and reserved space.

To see your own public address, use what is my IP address. For AND, OR and shifts on arbitrary numbers, try the bitwise calculator, and to convert an address octet between decimal, binary and hex, the number base converter.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 has 2⁸ = 256 addresses; the first is the network address and the last is the broadcast address, leaving 254 for hosts. In general a prefix /p gives 2^(32 − p) − 2 usable hosts for p up to 30.

What is a wildcard mask?

The bitwise inverse of the subnet mask: 255.255.255.0 becomes 0.0.0.255. Cisco access lists and OSPF network statements use wildcard masks, where a 0 bit means "must match" and a 1 bit means "don't care".

Why does a /31 have two usable addresses?

RFC 3021 allows /31 subnets on point-to-point links, where a broadcast address is pointless. Both addresses are assigned to the two ends of the link, saving address space compared with a /30.

Which IPv4 addresses are private?

The RFC 1918 ranges 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are free to use inside any network but are not routed on the public internet; NAT translates them to a public address. 100.64.0.0/10 is a separate shared range used by carriers for large-scale NAT.

How do I pick a prefix for a given number of hosts?

Find the smallest power of 2 that is at least the host count plus 2, then subtract its exponent from 32. For 50 hosts: 52 → 64 = 2⁶, so use a /26, which offers 62 usable addresses.

Last reviewed October 2026 by the CalcFluent editorial team. How we check our calculators.