Skip to content
SubnettingCalculator
IPv4 Detecting…
IPv6 Detecting…

Subnet Calculator – Free Online IPv4 & CIDR Tool

Enter an IPv4 address and a CIDR prefix. Get the network address, broadcast address, usable host range, total hosts and wildcard mask in one click. It is free, fast and runs in your browser. No sign-up needed.

IPv4 Subnet Calculator

Type an IPv4 address and a subnet mask, or move the CIDR slider, to see the full subnet details.

/24

Subnet Details

What is a subnet calculator?

A subnet calculator is a tool that does subnet maths for you. You give it an IPv4 address and a subnet mask (or a CIDR number like /24). It tells you everything about the subnet that address belongs to.

It shows you:

  • The network address (the start of the subnet)
  • The broadcast address (the end of the subnet)
  • The first and last usable IP you can give to devices
  • The number of hosts the subnet can hold
  • The wildcard mask used in router and firewall rules

You can use it to plan a network, set up routers and firewalls, write access lists, study for a networking exam, or check if two devices are in the same subnet.

How to use this calculator

Using the calculator takes only a few seconds. Follow these steps.

1Enter an IP address

Type an IPv4 address in the IP Address box, for example 192.168.0.1. An IPv4 address has four numbers separated by dots. Each number must be from 0 to 255.

  • You can only type numbers and dots. Other characters are removed for you.
  • Numbers like 256 or 01 are not allowed. The box turns red and shows a short message if something is wrong.
  • IPv6 addresses are not supported.
2Choose the subnet size

You can set the size in two ways. Both ways always stay in sync, so use the one you like.

  • Type a subnet mask in the Subnet Mask box, for example 255.255.255.0.
  • Move the CIDR slider from 0 to 32. The mask updates by itself. A bigger number means a smaller subnet.
Shortcut: You can paste an address with its prefix, like 10.0.5.17/22, into the IP Address box. The calculator will fill in the IP, the CIDR and the mask for you.
3Read the results

The Subnet Details table updates as you type. Here is what each row means:

  • Network Address – the first address of the subnet. It names the subnet and is not given to a device.
  • First Usable IP – the first address you can give to a device.
  • Last Usable IP – the last address you can give to a device.
  • Broadcast Address – the last address of the subnet. It is used to reach all devices at once and is not given to a device.
  • Total Usable Hosts – how many devices you can connect.
  • Total Available Hosts – all addresses in the subnet, including the network and broadcast addresses.
  • Subnet Mask – the mask in dotted form, for example 255.255.255.0.
  • Wildcard Mask – the opposite of the subnet mask. Cisco access lists and OSPF use it.
  • Binary Subnet Mask – the same mask written in 1s and 0s.
  • IP Type – tells you if your address is private, public, loopback, multicast and so on, and its class (A to E).
4Copy or download
  • Click Copy to copy all results as plain text. You can paste it into a document or a chat.
  • Click Download to save all results as a CSV file. You can open it in Excel or Google Sheets.
  • Both buttons are turned off while the IP address or mask has an error.

Common mistakes

  • "Not a valid subnet mask" – a mask must be a row of 1s followed by a row of 0s. 255.255.255.0 is valid. 255.0.255.0 is not.
  • Wrong number of hosts – remember that two addresses (network and broadcast) are not usable. A /24 has 256 addresses but only 254 usable hosts.
  • Results look empty – check the IP Address and Subnet Mask boxes for a red message.

How the subnet maths works

An IPv4 address is a 32-bit number. The subnet mask splits those 32 bits into two parts: the network part (the 1s in the mask) and the host part (the 0s in the mask). All the results come from these simple rules:

Network address = IP address AND subnet mask Wildcard mask = NOT subnet mask (flip every bit) Broadcast address = Network address OR wildcard mask = Network address + Total addresses − 1 First usable IP = Network address + 1 Last usable IP = Broadcast address − 1 Total addresses = 2 ^ (32 − CIDR) Usable hosts = Total addresses − 2

Two ways to find the broadcast address. Both give the same answer. The first way sets every host bit to 1 (that is what OR with the wildcard mask does). The second way adds the number of addresses, minus 1, to the network address. For 192.168.0.0/24: 192.168.0.0 + 255 = 192.168.0.255.

Worked example: 192.168.0.1/24

Step 1. Write the IP address and the mask in binary (/24 means the first 24 bits are 1s):

IP address 192.168.0.1 = 11000000.10101000.00000000.00000001 Subnet mask 255.255.255.0 = 11111111.11111111.11111111.00000000

Step 2. Network address: AND the two lines. A bit stays 1 only if both bits are 1.

11000000.10101000.00000000.00000000 = 192.168.0.0

Step 3. Wildcard mask: flip every bit of the subnet mask.

00000000.00000000.00000000.11111111 = 0.0.0.255

Step 4. Broadcast address: OR the network address with the wildcard mask. This turns all host bits into 1s.

11000000.10101000.00000000.11111111 = 192.168.0.255

Step 5. Count the hosts. There are 8 host bits (32 − 24 = 8), so the subnet has 28 = 256 addresses. Remove the network and broadcast addresses and 254 are usable. The first usable IP is 192.168.0.1 and the last is 192.168.0.254.

This is the result you get from the calculator. The table below is built live with the same code, so it always matches the calculator:

Why subtract 2?

The first address names the network. The last address is the broadcast address. A normal device cannot use either of them, so usable hosts = total addresses − 2.

There are two special cases:

  • /31 – used for links between two routers (RFC 3021). Both addresses are usable, so there are 2 hosts and no broadcast address.
  • /32 – a single host. The subnet has only 1 address.

IPv4 CIDR chart (/0 to /32)

This chart lists every prefix length with its subnet mask, wildcard mask and host counts. Usable hosts are the total addresses minus 2, except for /31 (2 usable) and /32 (1 usable).

CIDRSubnet maskWildcardTotal addressesUsable hosts

Standard IPv4 classes

In the old classful system, the first number of an IPv4 address decides its class. Each class has a default subnet mask. Today, networks use CIDR instead, so you can pick any prefix length. The classes are still useful for learning and for exams.

ClassFirst numberIP rangeDefault maskCIDRNetworksHosts per networkUsed for
A1 – 1261.0.0.0 – 126.255.255.255255.0.0.0/812616,777,214Very large networks
–127127.0.0.0 – 127.255.255.255Not used–––Loopback (reserved)
B128 – 191128.0.0.0 – 191.255.255.255255.255.0.0/1616,38465,534Medium networks
C192 – 223192.0.0.0 – 223.255.255.255255.255.255.0/242,097,152254Small networks
D224 – 239224.0.0.0 – 239.255.255.255Not used–––Multicast
E240 – 255240.0.0.0 – 255.255.255.255Not used–––Reserved for research

Class A starts at 1 and ends at 126. The blocks 0.0.0.0/8 ("this network") and 127.0.0.0/8 (loopback) are reserved. They are not normal Class A networks, so Class A has 126 networks.

Private and special IPv4 ranges

These ranges are set aside for special uses. The IP range column shows the first and last address of each block.

RangeIP rangeTotal addressesPurpose
10.0.0.0/810.0.0.0 – 10.255.255.25516,777,216Private (RFC 1918)
172.16.0.0/12172.16.0.0 – 172.31.255.2551,048,576Private (RFC 1918)
192.168.0.0/16192.168.0.0 – 192.168.255.25565,536Private (RFC 1918)
100.64.0.0/10100.64.0.0 – 100.127.255.2554,194,304Shared address space (carrier-grade NAT)
127.0.0.0/8127.0.0.0 – 127.255.255.25516,777,216Loopback
169.254.0.0/16169.254.0.0 – 169.254.255.25565,536Link-local (APIPA)
224.0.0.0/4224.0.0.0 – 239.255.255.255268,435,456Multicast

Frequently asked questions

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) writes a subnet mask as a slash followed by a number. The number tells you how many bits belong to the network part. For example, /24 means the first 24 bits are the network part. This is the same as the mask 255.255.255.0.

What is a subnet mask?

A subnet mask tells you which part of an IPv4 address is the network and which part is the host. Where the mask has 1s, those bits are the network part. Where it has 0s, those bits are the host part. For example, 255.255.255.0 means the first three numbers are the network and the last number is the host.

What is the difference between a subnet mask and a wildcard mask?

A wildcard mask is the opposite of a subnet mask. Where the subnet mask has 1s, the wildcard mask has 0s, and where the subnet mask has 0s, the wildcard mask has 1s. For example, the mask 255.255.255.0 has the wildcard mask 0.0.0.255. Wildcard masks are used in Cisco ACLs and OSPF network statements.

How do I find the broadcast address?

Take the network address and change every host bit to 1. A quick way is to add the total number of addresses, minus 1, to the network address. For 192.168.0.0/24 there are 256 addresses, so the broadcast address is 192.168.0.0 + 255 = 192.168.0.255. You can also OR the network address with the wildcard mask.

Why do we subtract 2 from the number of hosts?

The first address in a subnet is the network address. It names the subnet. The last address is the broadcast address. It is used to reach every device at once. You cannot give either of them to a normal device, so usable hosts = total addresses − 2.

How many usable hosts are in a /24, /25, /26, /27, /28, /29 and /30?

A /24 has 254 usable hosts, a /25 has 126, a /26 has 62, a /27 has 30, a /28 has 14, a /29 has 6 and a /30 has 2. You can see every prefix in the CIDR chart on this page.

What are /31 and /32 subnets?

A /31 is used for a link between two devices, such as two routers (RFC 3021). Both addresses can be used, so there is no network or broadcast address. A /32 is a single host address. It has only one address.

How do I find the subnet mask from a CIDR number?

Write that many 1s, fill the rest of the 32 bits with 0s, and then split the bits into four groups of eight. For /26 you get 11111111.11111111.11111111.11000000, which is 255.255.255.192. You can also move the CIDR slider and read the mask.

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

Count the 1-bits in the mask. The mask 255.255.255.192 has 26 bits set to 1, so it is /26. You can also type the mask in the calculator and the CIDR slider will move to the right number.

How can I tell if two IP addresses are in the same subnet?

Use the same subnet mask for both addresses and calculate the network address of each one. If the two network addresses are the same, the addresses are in the same subnet. For example, 192.168.1.10 and 192.168.1.200 are both in 192.168.1.0/24.

Which IPv4 ranges are private?

Three ranges are private (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. These addresses are used inside homes, offices and data centers. They are not routed on the public internet.

What do IP class and IP type mean in the results?

The IP class comes from the first number of the address: Class A is 1–126, Class B is 128–191, Class C is 192–223, Class D (multicast) is 224–239 and Class E (reserved) is 240–255. The numbers 0 and 127 are reserved ("this network" and loopback), so they do not belong to a class. Classes are an older system, and CIDR has replaced them for real networks. The IP type tells you if the address is private, public, loopback, link-local, multicast or reserved.

Can I paste an address with its CIDR, like 10.0.5.17/22?

Yes. Paste it into the IP Address box. The calculator fills in the IP address, the CIDR number and the subnet mask for you.

Why does the calculator reject my subnet mask?

A valid mask is a row of 1-bits followed by a row of 0-bits, with no mixing. A value like 255.0.255.0 looks like an IP address, but it is not a valid mask. Try 255.255.255.0 or use the CIDR slider.

Does this tool support IPv6?

No. This calculator works with IPv4 only, and the address box accepts only IPv4 addresses. The bar at the top of the page can still show your own IPv6 address if your network has one.

Are my inputs sent anywhere?

No. All subnet calculations run in your browser, so the addresses you enter stay on your device. Only the bar at the top of the page asks outside services for your own public IP address and location.