Skip to content
Sponsored AccsZone — accounts produced in-house

Subnet calculator

Convert any IPv4 or IPv6 address and prefix length into its network address, range, subnet mask, wildcard mask and host count. The calculation runs in your browser and nothing is sent to a server.

202.246.176.0/22

IPv4 · public range
Network address
202.246.176.0
Broadcast address
202.246.179.255
Usable hosts
1,022
Subnet mask
255.255.252.0
First host
202.246.176.1
Last host
202.246.179.254
Total addresses
1,024
Wildcard mask
0.0.3.255
Mask (binary)
11111111.11111111.11111100.00000000
Network (binary)
11001010.11110110.10110000.00000000
Integer range
3405164544 – 3405165567
Network (hex)
0xCAF6B000
Host bits
10
Classful network
C
Number of /24 blocks
4
Reverse DNS zone
246.202.in-addr.arpa
Sponsored
Advertise here 336×280 large rectangle · 728×90 on wide screens

How this tool works

Type an address and a prefix length in CIDR form, such as 10.20.30.40/22 or 2001:db8:abcd::/48. The calculation happens entirely in your browser with JavaScript; no address you enter leaves your computer, and the tool works offline once the page has loaded.

The math is binary. An IPv4 address is 32 bits, an IPv6 address 128. The prefix length says how many leading bits belong to the network. The calculator builds the mask from that number, performs a bitwise AND with the address to find the network address, sets every host bit to 1 to find the last address, and derives everything else from those two values: the first and last usable host, the number of addresses, the subnet mask and the wildcard mask.

For IPv6 the same steps apply to 128-bit values. The tool expands the compressed form you type (the :: shorthand) into all 8 groups, computes the first and last address of the prefix, and shows the result both compressed and expanded. Prefix lengths up to /128 are accepted.

The CIDR and subnet mask glossary entries cover the background if the terms are new.

How to read the result

Network address. The first address of the block, with all host bits 0. It names the subnet in routing tables and firewall rules and is not assigned to a device.

Broadcast address (IPv4). The last address of the block, with all host bits 1. Packets sent here reach every host in the subnet. Also not assigned to a device.

Usable host range. Everything between the two. For a /24 that is .1 through .254. The default gateway is conventionally the first or last usable address, but nothing enforces that.

Number of hosts. Total addresses minus 2 for IPv4. The /31 and /32 cases are special: a /31 is used for point-to-point links with both addresses usable, and a /32 is a single address.

Subnet mask and wildcard mask. The mask in dotted form, for example 255.255.252.0 for a /22, and its inverse, 0.0.3.255, used in access lists and some routing protocol configurations.

Total addresses. The size of the block, including the network and broadcast addresses. Each step shorter in the prefix doubles it.

IPv6 results. The prefix, the first and last address, the total number of addresses, and the expanded and compressed notations. There is no broadcast and no usable-host subtraction.

IPv4 prefix lengths at a glance

Prefix Subnet mask Addresses Usable hosts Typical use
/8 255.0.0.0 16,777,216 16,777,214 The old class A; the 10.0.0.0/8 private range
/16 255.255.0.0 65,536 65,534 The old class B; 192.168.0.0/16 private range as a whole
/20 255.255.240.0 4,096 4,094 A campus or a cloud VPC
/22 255.255.252.0 1,024 1,022 A large office or a cloud subnet
/24 255.255.255.0 256 254 The standard LAN; the smallest block most ISPs will route
/25 255.255.255.128 128 126 Half a /24
/26 255.255.255.192 64 62 A small office
/27 255.255.255.224 32 30 A server rack or a small branch
/28 255.255.255.240 16 14 A handful of servers
/29 255.255.255.248 8 6 The usual size of a static block from an ISP
/30 255.255.255.252 4 2 A point-to-point link, older style
/31 255.255.255.254 2 2 (special) A point-to-point link, modern style
/32 255.255.255.255 1 1 (host) A single host route or a firewall rule for one address

IPv6 prefix lengths at a glance

Prefix What it usually is
/32 An allocation to an ISP from a regional registry
/48 A site: one organization or one customer location, giving 65,536 /64 subnets
/56 A typical residential or small-business assignment, giving 256 /64 subnets
/64 One LAN or VLAN; the fixed size required for address autoconfiguration
/127 A point-to-point link between routers
/128 A single address

How to subnet a network

  1. Decide how many subnets you need and how many hosts the largest one must hold. Leave room to grow; renumbering later is painful.
  2. Find the smallest prefix that holds the largest subnet. For 100 hosts, a /25 (126 usable) fits; for 300, you need a /23.
  3. Enter your parent block's network address with that prefix length. The result is the first subnet; add its total address count to the network address to get the second, and repeat until the parent block is used up.
  4. Assign the subnets to their purposes and record the gateway address for each.
  5. If subnets of different sizes are needed, allocate the largest first from the start of the block, then split the remainder for the smaller ones. This variable-length approach avoids wasting address space.
  6. Write the result into the router's interface configuration, the DHCP scopes and the firewall rules using the exact network address and mask the calculator shows; an off-by-one in the mask is the most common cause of hosts that can reach some neighbors but not others.

For IPv6, skip the host arithmetic. Give every LAN a /64 and plan at the level of how many /64s you need; a /56 or /48 from your provider almost always holds far more than you will use.

Checking whether two addresses share a subnet

Enter the first address with the subnet's prefix length and note the network address. Do the same for the second. If both produce the same network address, they are in the same subnet and can talk to each other directly; if not, traffic between them goes through a router. This single check resolves a large share of "can ping one host but not another" problems.

The same test tells you whether a given address falls inside a range you have been given, such as a cloud security group rule or an ISP's documented block. For the networks that announce public ranges and the blocks they contain, the ASN lookup and WHOIS lookup show the public view.

A worked example

Take the address 192.168.10.77 with a prefix length of 26. The mask for /26 has 26 one-bits followed by 6 zero-bits, which is 255.255.255.192. The last octet of the address, 77, is 01001101 in binary; keeping the top 2 bits and clearing the rest gives 01000000, which is 64. So the network address is 192.168.10.64. Setting the 6 host bits to 1 gives 01111111, which is 127, so the broadcast address is 192.168.10.127. The usable hosts run from 192.168.10.65 to 192.168.10.126, 62 in total, and the wildcard mask is 0.0.0.63.

The same block splits into 4 subnets of /28 each: .64 to .79, .80 to .95, .96 to .111 and .112 to .127, each with 14 usable hosts. Enter 192.168.10.64/28 to see the first one, then add 16, the size of a /28, to get the next network address.

Private and special address ranges

The calculator treats every block alike, so it helps to recognize the ranges that are not routed on the public internet.

Range Purpose
10.0.0.0/8 Private networks, the largest block; common in companies and cloud providers
172.16.0.0/12 Private networks; often used by container platforms and home routers
192.168.0.0/16 Private networks; the usual home and small-office range
100.64.0.0/10 Shared address space for carrier-grade NAT inside ISPs
169.254.0.0/16 Link-local; self-assigned when no DHCP server answers
127.0.0.0/8 Loopback; always the local machine
fe80::/10 IPv6 link-local; present on every IPv6 interface
fc00::/7 IPv6 unique local addresses, the private equivalent for IPv6

An address from any of the private ranges is invisible from the internet, which is why looking up your own address from inside your network shows a different number than the public address a website sees. The IP lookup shows the public one.

Limits of this tool

  • The calculator performs arithmetic. It does not check whether an address is in use, whether a network is reachable or whether a block is routed on the internet.
  • For /31 and /32 the usable-host figure depends on convention; the classic formula gives 0, while modern point-to-point links use both addresses of a /31. Check what your equipment supports.
  • Address classes (A, B, C) are not part of the result. Classful addressing has not been used on the internet for decades; the prefix length is what matters.
  • Reserved and special ranges, such as private, loopback, link-local and multicast blocks, are calculated like any other block. The tool does not flag them.
  • IPv6 results show the total number of addresses without subtracting anything. Some addresses within a prefix, such as the subnet-router anycast address, have conventional roles.
  • Very large IPv6 blocks have address counts that run to 39 digits; they are shown in full but are rarely meaningful in practice.
  • The page needs JavaScript. Without it the form is displayed but no result is produced.

Questions people ask

What does CIDR notation mean?

An address followed by a slash and a number, such as 192.168.10.0/24. The number is the prefix length: how many leading bits of the address identify the network. The remaining bits identify hosts inside it.

How many usable hosts are in a /24?

254. A /24 contains 256 addresses; the first is the network address and the last is the broadcast address, which leaves 254 for devices.

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

The subnet mask has 1 bits for the network part and 0 bits for the host part, for example 255.255.255.0. The wildcard mask is its inverse, 0.0.0.255, and is the form some router access lists expect.

Why do /31 and /32 show no usable hosts in the usual formula?

The formula subtracts the network and broadcast addresses, which leaves 0 for /31 and a negative number for /32. In practice a /31 is used for point-to-point links with both addresses usable, and a /32 is a single host route.

Does IPv6 have a broadcast address?

No. IPv6 uses multicast instead, so a prefix has a first and last address but no reserved broadcast, and the calculator shows the total number of addresses rather than a usable count.

What is the standard size of an IPv6 subnet?

A /64. Address autoconfiguration requires it, so almost every LAN gets a /64, and sites are typically assigned a /56 or /48 to carve into many of them.

Can the calculator help me split a network into smaller subnets?

Yes. Enter the network with a longer prefix length to see the size and range of one resulting subnet; each extra bit doubles the number of subnets and halves their size. Add the block size to the network address to get the next subnet.

Is my input sent anywhere?

No. The calculator is JavaScript running in your browser. Addresses you enter stay on your device.