How many total IP can get when I use 255.255 255.240 as the subnet mask in the IP?

This calculator returns a variety of information regarding Internet Protocol version 4 (IPv4) and IPv6 subnets including possible network addresses, usable host ranges, subnet mask, and IP class, among others.

IPv4 Subnet Calculator

IPv6 Subnet Calculator


A subnet is a division of an IP network (internet protocol suite), where an IP network is a set of communications protocols used on the Internet and other similar networks. It is commonly known as TCP/IP (Transmission Control Protocol/Internet Protocol).

The act of dividing a network into at least two separate networks is called subnetting, and routers are devices that allow traffic exchange between subnetworks, serving as a physical boundary. IPv4 is the most common network addressing architecture used, though the use of IPv6 has been growing since 2006.

An IP address is comprised of a network number (routing prefix) and a rest field (host identifier). A rest field is an identifier that is specific to a given host or network interface. A routing prefix is often expressed using Classless Inter-Domain Routing (CIDR) notation for both IPv4 and IPv6. CIDR is a method used to create unique identifiers for networks, as well as individual devices. For IPv4, networks can also be characterized using a subnet mask, which is sometimes expressed in dot-decimal notation, as shown in the "Subnet" field in the calculator. All hosts on a subnetwork have the same network prefix, unlike the host identifier, which is a unique local identification. In IPv4, these subnet masks are used to differentiate the network number and host identifier. In IPv6, the network prefix performs a similar function as the subnet mask in IPv4, with the prefix length representing the number of bits in the address.

Prior to the introduction of CIDR, IPv4 network prefixes could be directly obtained from the IP address based on the class (A, B, or C, which vary based on the range of IP addresses they include) of the address and the network mask. Since the introduction of CIDRs, however, assigning an IP address to a network interface requires both an address and its network mask.

Below is a table providing typical subnets for IPv4.

Prefix size Network mask Usable hosts per subnet
/1 128.0.0.0 2,147,483,646
/2 192.0.0.0 1,073,741,822
/3 224.0.0.0 536,870,910
/4 240.0.0.0 268,435,454
/5 248.0.0.0 134,217,726
/6 252.0.0.0 67,108,862
/7 254.0.0.0 33,554,430
Class A
/8 255.0.0.0 16,777,214
/9 255.128.0.0 8,388,606
/10 255.192.0.0 4,194,302
/11 255.224.0.0 2,097,150
/12 255.240.0.0 1,048,574
/13 255.248.0.0 524,286
/14 255.252.0.0 262,142
/15 255.254.0.0 131,070
Class B
/16 255.255.0.0 65,534
/17 255.255.128.0 32,766
/18 255.255.192.0 16,382
/19 255.255.224.0 8,190
/20 255.255.240.0 4,094
/21 255.255.248.0 2,046
/22 255.255.252.0 1,022
/23 255.255.254.0 510
Class C
/24 255.255.255.0 254
/25 255.255.255.128 126
/26 255.255.255.192 62
/27 255.255.255.224 30
/28 255.255.255.240 14
/29 255.255.255.248 6
/30 255.255.255.252 2
/31 255.255.255.254 0
/32 255.255.255.255 0

Taking an example IP address of 192.168.86.42, and a subnet mask of 255.255.255.0 (a /24 subnet), let's manually calculate the network and IP properties for this IP address.

IP type

Check if the IP address is within any of the ranges of private IP addresses. If it is, then it is a private address. Otherwise, it is a public address. Looking at the ranges, we see that 192.168.86.42 is in the range 192.168.0.0 – 192.168.255.255 - a private address.

IP class

Looking through the ranges of each class in the previous section, we see that the IP address 192.168.86.42 is in the range 192.0.0.0 - 223.255.255.255, so it is a Class C IP address.

Network address

Let's go through the calculation of the network address, step-by-step.

  1. Convert both the IP address and subnet mask to binary, and write them down, one above the other.
    11000000101010000101011000101010
    11111111111111111111111100000000

  2. Perform a bitwise logical AND operation by reading down a column at a time. If there are two ones, write a one as the result. Otherwise, write a zero.
    11000000101010000101011000000000

  3. Divide up the binary number into 8-bit blocks and convert it back to decimal.
    11000000.10101000.01010110.00000000
    192.168.86.0

So, 192.168.86.0 is the network address.

Total number of addresses

Next, we'll calculate the total number of addresses, as we need that to work out the broadcast address. Use the equation for the total number of addresses, given that the CIDR is 24.

  • 2(32−CIDR)2^{(32 - \text{CIDR})}
  • 2(32−24)2^{(32 - 24)}
  • 282^8
  • 256256

So, the total number of addresses is 256.

Broadcast address

Now, we can calculate the broadcast address. Convert the network address from binary to decimal, which gives 3,232,257,536. Add 256 - 1 to get 3,232,257,791. Then convert this back to binary, separate it into 8-bit blocks, and convert to decimal.

3,232,257,791
11000000101010000101011011111111
11000000.10101000.01010110.11111111
192.168.86.255

So, the broadcast address for our example is 192.168.86.255.

First and last host addresses

For the first usable host address, we add one to the network address. While you can do all of the converting to a decimal number, adding one, and switching back to the quad-dotted decimal format, usually, it's easy to work directly with the quad-dotted decimal. Adding one to the network address 192.168.86.0 is simply a matter of adding one to the last octet. Therefore it's 192.168.86.1 for the first usable host address.

The same can be said when calculating the last usable host address, which is the broadcast address minus one. That gives a result of 192.168.86.254.

Wildcard mask

To calculate the wildcard mask, convert the subnet mask to binary and flip all the bits. Then switch back to the quad-dotted decimal format.

  • 11111111111111111111111100000000 – binary subnet mask
  • 00000000000000000000000011111111 – bits are flipped
  • 0.0.0.255 – convert back to quad-dotted decimal format

The wildcard mask for our example is 0.0.0.255.

IP address in integer and hexadecimal

Using the binary form of the IP address, we can convert the binary number to integer (base 10) and hexadecimal (base 16).

  • 11000000101010000101011000101010 – example IP address as a binary number
  • 3232257578 – integer number
  • 0xc0a8562a – hexadecimal number

in-addr.arpa

Reverse the example IP address 192.168.86.42 to get 42.86.168.192 and put it in front of in-addr.arpa to get 42.86.168.192.in-addr.arpa.

IPv4-mapped IPv6 address

IPv4-mapped IPv6 addresses consist of the prefix ::ffff: followed by the IPv4 address, either displayed in hexadecimal (IPv6 native) format or the IPv4 quad-dotted decimal format. The results for our example IP address is:

  • ::ffff:c0a8:562a
  • ::ffff:192.168.86.42

6to4 prefix

The 6to4 prefix consists of 2002: followed by the IP address in hexadecimal format. You can convert each octet to hexadecimal individually and write them out in the IPv6 form.

  • 192.168.86.42 is c0.a8.56.2a in hexadecimal
  • 2002:c0a8:562a::/48 is the 6to4 prefix

That's a lot of work here, isn't it? Thanks to our IP address subnet calculator, you can obtain all of this information in a minute!

How many host bits will there be with a 255.255 255.224 subnet mask?

A /27 (255.255. 255.224) is 3 bits on and 5 bits off. This provides 8 subnets, each with 30 hosts. Does it matter if this mask is used with a Class A, B, or C network address?

How many IP addresses does 255.255 255.0 have?

A subnet mask of 255.255. 255.0 allows for close to 256 unique hosts within the network (since not all 256 IP addresses can be used). If your computer is connected to a network, you can view the network's subnet mask number in the Network control panel (Windows) or System Preference (macOS).

What is the valid host range for the 255.255 255.248 subnet?

255.248. What are the subnet, broadcast address, and host range that this host is a member of? The answer is: 256-248=8, 16, 24. This host is in the 16 subnet, the broadcast address of the 16 subnet is 23, and the valid host range is 17-22.