keencalculator
  1. Home
  2. Tech & Screens
  3. IP Subnet Calculator

IP Subnet Calculator

Enter an IPv4 address and a prefix length such as /24 to see the subnet it belongs to: the network and broadcast addresses, the first and last usable host, how many hosts fit, and the subnet and wildcard masks.

Quick examples

You can also type CIDR notation such as 10.0.0.5/20.

bits

/24 is the mask 255.255.255.0.

Your numbers stay in your browser. Nothing is uploaded.
Network192.168.1.0/24
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Usable hosts
254
Total addresses
256
Address type
Private (RFC 1918)

Saved setups

Save a set of inputs you reuse — your usual rate, your loan, your room sizes — and load it back in one tap.

    Your recent calculations

    Results you calculate here are kept on this device so you can come back to them.

      Formula

      Total addresses = 2^(32 − prefix)
      Usable hosts = total addresses − 2 (network and broadcast)
      Network address = IP address AND subnet mask
      Broadcast address = network address + total addresses − 1
      Wildcard mask = 255.255.255.255 − subnet mask

      How to use it

      1. Type the IPv4 address, or paste CIDR notation such as 10.0.0.5/20.
      2. Enter the prefix length, from 0 to 32.
      3. Read the network, host range and masks.

      Worked examples

      192.168.1.10 with a /24 prefix

      Network
      192.168.1.0/24
      Subnet mask
      255.255.255.0
      Wildcard mask
      0.0.0.255
      Broadcast address
      192.168.1.255
      First usable host
      192.168.1.1
      Last usable host
      192.168.1.254
      Usable hosts
      254
      Total addresses
      256
      Address type
      Private (RFC 1918)

      10.20.30.40 with a /20 prefix: the third octet 30 falls in the 16–31 block

      Network
      10.20.16.0/20
      Subnet mask
      255.255.240.0
      Wildcard mask
      0.0.15.255
      Broadcast address
      10.20.31.255
      First usable host
      10.20.16.1
      Last usable host
      10.20.31.254
      Usable hosts
      4,094

      172.16.5.130 with a /26 prefix: blocks of 64, so 130 falls in 128–191

      Network
      172.16.5.128/26
      Subnet mask
      255.255.255.192
      Broadcast address
      172.16.5.191
      First usable host
      172.16.5.129
      Last usable host
      172.16.5.190
      Usable hosts
      62

      Common prefix lengths

      /8 is 255.0.0.0 with 16,777,214 hosts. /16 is 255.255.0.0 with 65,534. /24 is 255.255.255.0 with 254. /25 has 126, /26 has 62, /27 has 30, /28 has 14, /29 has 6 and /30 has 2.

      The two special cases

      A /31 has only two addresses and no room for separate network and broadcast addresses; under RFC 3021 both are usable on point-to-point links, so 2 hosts are shown. A /32 is a single address, used for host routes and loopbacks.

      Private address ranges

      RFC 1918 reserves three blocks for private networks: 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. These are not routed on the public internet.

      Questions people ask

      How many hosts are in a /24 subnet?

      254 usable hosts. There are 256 addresses, less one for the network address and one for broadcast.

      What subnet mask is /26?

      255.255.255.192, which gives 64 addresses and 62 usable hosts per subnet.

      What is a wildcard mask?

      The inverse of the subnet mask, used in access control lists and OSPF configuration. For /24 it is 0.0.0.255.

      Related calculators