Skip to content
Calc.

IP Subnet Calculator

Enter an IPv4 address and CIDR prefix to get the network address, subnet mask, usable host range, host count and broadcast address.

Last updated: October 2026

Subnet details

Network 192.168.1.0/24 · Mask 255.255.255.0 · Hosts 192.168.1.1 – 192.168.1.254 (254 usable) · Broadcast 192.168.1.255

Formula below · 1 source (rfc-editor.org) · Updated Oct 2026

Compare with similar

About this calculator

An IPv4 address has 32 bits. A CIDR prefix such as /24 says the first 24 bits name the network and the remaining 32 − 24 = 8 bits number the hosts inside it, so the block holds 2⁸ = 256 addresses.

What the calculator works out

Subnet mask: the prefix written as 1-bits followed by 0-bits, in dotted decimal. /24 is 255.255.255.0 and /26 is 255.255.255.192. Network address: your address with all host bits set to 0 (the address AND the mask). 192.168.1.10/24 is in network 192.168.1.0. Broadcast address: the network with all host bits set to 1, here 192.168.1.255. Usable hosts: everything between the two, 192.168.1.1 to 192.168.1.254, which is 2⁸ − 2 = 254 addresses.

The −2 applies to ordinary subnets, because the network and broadcast addresses cannot be given to a device. RFC 3021 allows a /31 on point-to-point links with both addresses usable and no broadcast, and a /32 is a single host. The calculator follows those rules.

IPv6 works differently: subnets are normally /64 and there is no broadcast address, so this page covers IPv4 only.

IPv4 prefix lengths, masks and usable hosts

Scroll sideways to see all columns →

PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/22255.255.252.01,0241,022
/23255.255.254.0512510
/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 (RFC 3021)
/32255.255.255.25511
Source: RFC 4632: Classless Inter-Domain Routing (CIDR)

How to use

Type any address in the subnet and its prefix length (the number after the slash). Example 1: 192.168.1.10 /24 → Network 192.168.1.0/24 · Mask 255.255.255.0 · Hosts 192.168.1.1 – 192.168.1.254 (254 usable) · Broadcast 192.168.1.255. Example 2: 10.20.30.77 /26 → Network 10.20.30.64/26 · Mask 255.255.255.192 · Hosts 10.20.30.65 – 10.20.30.126 (62 usable) · Broadcast 10.20.30.127. Example 3: 172.16.5.4 /30, a router-to-router link → Network 172.16.5.4/30 · Hosts 172.16.5.5 – 172.16.5.6 (2 usable) · Broadcast 172.16.5.7.

Frequently asked questions

Why are there 2 fewer usable hosts than addresses?

In a normal subnet the first address (all host bits 0) identifies the network and the last (all host bits 1) is the broadcast address, so neither can be assigned to a device. A /24 has 256 addresses and 254 usable hosts. RFC 3021 makes an exception for /31 point-to-point links.

How do I convert a CIDR prefix to a subnet mask?

Write the prefix as that many 1-bits followed by 0-bits and read it as four bytes. /26 = 11111111.11111111.11111111.11000000 = 255.255.255.192. Common ones: /8 = 255.0.0.0, /16 = 255.255.0.0, /24 = 255.255.255.0, /30 = 255.255.255.252.

How do I find the network address?

Apply a bitwise AND between the address and the mask. In the octet the mask splits, round down to a multiple of the block size: for /26 the block size is 64, so 10.20.30.77 falls in the block starting at 10.20.30.64.

Which prefix do I need for a given number of hosts?

Pick the smallest block with enough room after subtracting 2: 6 hosts → /29, 14 → /28, 30 → /27, 62 → /26, 126 → /25, 254 → /24. Leave headroom for growth.

Does this work for IPv6?

No. IPv6 addresses are 128 bits, LAN subnets are normally /64, and there is no broadcast address. This calculator handles IPv4 only.

Related calculators

Sources & references

How we check our calculators

Think a result is wrong? Report a problem with this calculator.