Skip to content
Calcapedia
Tech & Digital

IP Subnet Calculator

See which network an IPv4 address belongs to, with its broadcast address, usable address range, masks and binary form, from a CIDR prefix or subnet mask.

Level: College and adult

Printable worksheet

IP Subnet Calculator

Inputs

Four numbers from 0 to 255 separated by dots.

Network size given as

Result

Network (CIDR)

192.168.1.0/24

192.168.1.10/24 is in network 192.168.1.0/24, with hosts 192.168.1.1 to 192.168.1.254.

Network address
192.168.1.0
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
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Address type
Private (RFC 1918)

See the step-by-step solution ↓

Dotted-decimal and binary forms
Dotted-decimal and binary forms
FieldDotted decimalBinary
Address192.168.1.1011000000.10101000.00000001.00001010
Subnet mask255.255.255.011111111.11111111.11111111.00000000
Wildcard mask0.0.0.25500000000.00000000.00000000.11111111
Network192.168.1.011000000.10101000.00000001.00000000
Broadcast192.168.1.25511000000.10101000.00000001.11111111

Step-by-step solution

  1. Write the address in binary (ones and zeros), 8 bits for each of the four numbers, so you can see each bit

    192.168.1.10=11000000.10101000.00000001.00001010
  2. A /24 mask is 24 one-bits (the network part) followed by 8 zero-bits (the host part)

    /24=11111111.11111111.11111111.00000000=255.255.255.0
  3. Keep the address bits where the mask is 1 and set the rest to 0 (a bitwise AND). That leaves the network address

    11000000.10101000.00000001.00001010 AND 11111111.11111111.11111111.00000000=11000000.10101000.00000001.00000000=192.168.1.0/24
  4. Set every host bit to 1 to get the broadcast address, the last one in the block (network OR wildcard mask)

    192.168.1.0 OR 0.0.0.255=192.168.1.255
  5. 8 host bits give 2 to the power of 8 addresses. Take away 2, because the network and broadcast addresses can't be given to devices

    28−2=254

Test yourself

20 quick questions built from this calculator's formula: work out results, predict what happens when an input changes, and work backward from an answer. Every answer comes with the working.

What this calculator does

Find out which network an IP address belongs to, and which addresses you can give to devices on it. Every IPv4 address is a 32-bit number, meaning a string of 32 ones and zeros. It's usually written as four numbers called octets, each made of 8 bits, such as 192.168.1.10. A subnet splits those bits in two. The leading bits name the network, and the rest name a host (one device) on that network. The prefix length in CIDR notation, like the /24 in 192.168.1.10/24, says how many bits belong to the network. The subnet mask says the same thing as a dotted number (255.255.255.0).

Enter an address and either form of the mask. The calculator works out the network the address belongs to and its broadcast address. It also finds the first and last addresses you can assign to devices and how many hosts fit. You'll see the wildcard mask that routers use in their access lists, too. Finally, it shows the binary form of each value, so you can see exactly which bits are doing what.

Where it's used

Why this math matters outside the classroom:

  • Home networks. A home router on 192.168.1.0/24 has 254 usable addresses, from .1 to .254.
  • Office subnets. Network admins split a /24 into four /26 subnets of 62 usable hosts each for different departments.
  • Troubleshooting. Support staff check whether two devices share a subnet when they can't reach each other directly.
  • Exam practice. Students preparing for networking exams practise converting masks such as 255.255.255.192 to the /26 prefix.
  • Cloud networks. Cloud engineers plan address ranges for virtual networks so they don't overlap with office networks.

How to use it

  1. Type an IPv4 address in its usual dotted form, for example 10.20.30.40.
  2. Choose whether you'll give the network size as a CIDR prefix or as a subnet mask, then enter it.
  3. Read the network in CIDR form. Below it are the broadcast address, host range, host count, masks and the binary table.

What the inputs mean

IPv4 address
Any address inside the network you're asking about. It doesn't have to be the network address itself. Each of the four parts must be 0 to 255, written without leading zeros.
Prefix length
The number of 1 bits at the start of the mask. It runs from /0 (every address there is) to /32 (a single address).
Subnet mask
A dotted mask such as 255.255.255.192. A valid mask is a run of 1 bits followed only by 0 bits, so 255.0.255.0 is rejected.

Formula and method

mask = 32-bit value with the first p bits set to 1
wildcard = NOT mask
network = address AND mask
broadcast = network OR wildcard
usable hosts = 2^(32 − p) − 2   (2 for /31, 1 for /32)

Here p is the prefix length. AND, OR and NOT work on each bit separately. AND keeps an address bit where the mask has a 1 and clears it where the mask has a 0. That leaves only the network part. OR sets a bit to 1 if either side has a 1. NOT flips every bit. Setting all the host bits to 1 gives the broadcast address, the last address in the block.

A block with h host bits holds 2^h addresses. In ordinary subnets, the first address (the network) and the last (the broadcast) are reserved. That leaves two fewer for devices. Point-to-point links, which join exactly two devices, use a /31 prefix and use both addresses. A /32 describes one host.

Worked example

A device has the address 172.16.45.200 on a /20 network.

  1. A /20 mask is twenty 1 bits followed by twelve 0 bits: 255.255.240.0.
  2. The third octet is where the boundary falls. 45 is 00101101 in binary and 240 is 11110000, so 45 AND 240 = 00100000 = 32. The fourth octet is cleared to 0.
  3. The network is 172.16.32.0/20. Setting the twelve host bits to 1 gives the broadcast address 172.16.47.255.
  4. Hosts: 2^12 − 2 = 4,094, from 172.16.32.1 to 172.16.47.254.

Result: 172.16.45.200/20 sits in network 172.16.32.0/20. It has 4,094 usable addresses, from 172.16.32.1 to 172.16.47.254, and the wildcard mask is 0.0.15.255.

Understanding the result

Two devices can talk directly, without a router, only if they're in the same network. That means each one gives the same network address when ANDed with the mask. If a device has the wrong mask, it may send traffic for a neighbor through the gateway (the router to other networks). Or it may do the reverse.

The address type tells you what kind of address it is. It may be private (usable inside homes and organisations but not routed on the public internet), loopback (the device talking to itself) or link-local. It may also be multicast (sent to a group) or public.

Assumptions and limitations

  • IPv4 only. Addresses are written in the standard dotted form, without leading zeros.
  • Usable host counts follow common practice. The network and broadcast addresses are left out, except on /31 and /32 prefixes.
  • IPv6 is not supported. Its 128-bit addresses and notation need a separate tool.
  • The calculator doesn't split a block into smaller subnets, or combine several networks into one route.
  • Some equipment reserves extra addresses (for gateways or cloud services), so the practical number of hosts can be lower.

Frequently asked questions

What does the /24 in 192.168.1.0/24 mean?

It's the prefix length: the first 24 of the 32 bits name the network. That leaves 8 bits for hosts, giving 256 addresses, and 254 of them can be assigned to devices. It's the same as the mask 255.255.255.0.

Why are two addresses subtracted from the host count?

The first address in a block names the network itself. The last is the broadcast address, which reaches every host on the subnet at once. On an ordinary subnet, neither should be given to a single device.

What is a wildcard mask?

It's the subnet mask with every bit flipped, so 255.255.255.0 becomes 0.0.0.255. Router access lists and some routing protocols use it. It says which bits must match (0) and which can be anything (1).

Why does the calculator reject an address like 192.168.01.1?

A leading zero is unclear. Some software reads 010 as the octal (base-8) number 8 instead of ten. To avoid quietly working out the wrong network, the calculator asks you to write each part without leading zeros.

How this calculator is checked

Method: IPv4 addressing and CIDR (bitwise AND/OR on 32-bit addresses); /31 point-to-point convention per RFC 3021; special ranges per RFC 1918 and the IANA special-purpose registry. The calculation is covered by automated tests with known reference values and edge cases. Last updated 2026-10-18. Found a problem? Tell us.

Embed this calculator

Put this IP Subnet Calculator on your own website or blog for free. Paste this code where you want it to appear: