Developer Tools

IP Subnet Calculator: Network, Broadcast and Host Range

Enter an IPv4 address and a prefix length or subnet mask to get the network address, broadcast address, first and last usable host, number of hosts, subnet mask, wildcard mask and binary mask. You can also type the address in CIDR form, such as 10.0.0.5/20.

01

Your inputs

Start with the example, or enter your own values.

Processed in your browser. Your inputs stay on this device.

02

Your result

A little clarity, coming right up.

Make room for the answer.

Enter your values and run the tool. Your result will appear here.

How to use the IP Subnet Calculator

Type the IP address, then the prefix length (24) or the mask (255.255.255.0), and press Calculate. A /prefix written after the address takes priority.

Read more: How to Use the IP Subnet Calculator: Steps and a Worked Example

How a subnet is worked out

The prefix length says how many of the 32 bits belong to the network. The rest are host bits, so a /24 leaves 8 host bits and a block of 2⁸ = 256 addresses. The network address is the IP rounded down to a multiple of the block size, and the broadcast address is the last address in the block. For 192.168.1.10/24 that gives 192.168.1.0 to 192.168.1.255, with 254 usable hosts in between.

Common prefix lengths

/30 has 4 addresses and 2 usable hosts, used for point-to-point links. /29 has 8 and 6 usable, /28 has 16 and 14, /27 has 32 and 30, /26 has 64 and 62, /25 has 128 and 126, /24 has 256 and 254, /23 has 512 and 510, /22 has 1,024 and 1,022, /20 has 4,096 and 4,094, and /16 has 65,536 and 65,534.

Subnet mask and wildcard mask

The subnet mask has ones for the network bits: /20 is 255.255.240.0. The wildcard mask is its inverse, 0.0.15.255, and is used in router access lists and OSPF network statements.

Private and public addresses

10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private ranges from RFC 1918 and are not routed on the internet. 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local and 100.64.0.0/10 is shared address space used for carrier-grade NAT.

The formula

Block size = 2^(32 − prefix). Network = address rounded down to a multiple of the block size; broadcast = network + block size − 1; usable hosts = block size − 2.

Examples

  • With the default values
    Network address: 192.168.1.0/24
    Broadcast address: 192.168.1.255
    Usable host range: 192.168.1.1 to 192.168.1.254
    Usable hosts: 254

Limitations and assumptions

IPv4 only. /31 links (RFC 3021) and /32 single hosts have no separate network and broadcast address, so every address is counted as usable.

Frequently asked questions

How many usable hosts are in a /24?

254. A /24 has 256 addresses, minus the network address and the broadcast address.

Why does a /31 show 2 usable hosts?

RFC 3021 lets point-to-point links use both addresses of a /31, since no broadcast address is needed. A /32 is a single host.

What is 255.255.255.0 in CIDR?

/24, because the mask has 24 ones in binary.

Does this work for IPv6?

No, it handles IPv4 addresses only.