Skip to content

IP

Calculate a subnet from CIDR or a netmask

Network, netmask, broadcast, usable host range, reverse DNS zone and subnet splits for any IPv4 or IPv6 block, computed in your browser.

Runs in your browserNothing you paste or open here leaves this page. No account, no daily limit.

Try an example
CIDR
192.168.1.0/24
IP version
IPv4
Network address
192.168.1.0
Netmask
255.255.255.0
Wildcard mask
0.0.0.255
Prefix length
/24
Broadcast address
192.168.1.255
First usable host
192.168.1.1
Last usable host
192.168.1.254
Total addresses
256
Usable hosts
254
Binary mask
11111111.11111111.11111111.00000000
Reverse DNS zone
1.168.192.in-addr.arpa
Special-purpose range
Private-Use (RFC 1918)
Globally reachable
No

4 subnets of /26

4 subnets of /26
SubnetFirst addressLast addressAddresses
192.168.1.0/26192.168.1.0192.168.1.6364
192.168.1.64/26192.168.1.64192.168.1.12764
192.168.1.128/26192.168.1.128192.168.1.19164
192.168.1.192/26192.168.1.192192.168.1.25564
API access
Unlock with a free account

More with a free account

This page runs in your browser. A free account adds the checks that need our servers.

Unlock these fields

How to read the result

Type a block in CIDR notation, an address and a netmask, or a single address. The calculator normalizes the input to the network that contains it and shows the fields below. Every field is computed in your browser.

Field What it means What to do with it
CIDR The block in canonical form, such as 172.16.0.0/20 for an input of 172.16.5.4/20. Use this form in configurations and documentation.
Host bits warning Shown when the address you typed is not the first address of its block. Check whether you meant the block, or a host inside it with that prefix.
Network address The first address of the block, with every host bit at zero. The address routes and firewall rules refer to. Not assignable to a host in IPv4.
Netmask The prefix as a dotted mask, such as 255.255.240.0. IPv4 only. Paste it where a device asks for a subnet mask.
Wildcard mask The inverted netmask, such as 0.0.15.255. IPv4 only. Paste it where router access lists ask for a wildcard.
Binary mask The netmask written in bits, octet by octet. IPv4 only. Shows exactly where the network part ends.
Broadcast address The last address of an IPv4 block. None for a /31, a /32 or any IPv6 block. Not assignable to a host.
First and last usable host The range you can assign: network + 1 to broadcast - 1 in IPv4, the whole block for /31, /32 and IPv6. Plan your DHCP pool or static assignments inside it.
Total addresses 2 to the power of the host bits. The size of the block, used or not.
Usable hosts Total minus 2 for IPv4, all addresses for a /31, a /32 or IPv6. The number of devices the block can number.
Reverse DNS zone The in-addr.arpa or ip6.arpa zone of the block, when the prefix falls on an octet (IPv4) or nibble (IPv6) boundary. The zone to create or delegate for PTR records.
Special-purpose range The name and RFC of the IANA special-purpose range the block falls in, such as Private-Use (RFC 1918). Tells you whether the block is private, shared, documentation, loopback or ordinary public space.
Globally reachable Whether that range is reachable on the public internet, per the IANA registries. Public space with no special range is reachable. No means the block only works inside a private network or a special context.
Split into subnets Every smaller block of a chosen prefix, up to 16 bits longer, with the first 256 rows listed and the total count. Plan VLANs, sites or customer allocations.
API access Locked. Subnet math needs no API. The API's POST /ip describes one public address at a time: network, location, flags. Needs a free account, which includes 100 credits every month.

The calculator needs no account and has no daily limit.

How the calculation works

  1. Parsing. IPv4 is read in dotted decimal and IPv6 in full or compressed form. An address with no prefix is treated as a single host, /32 or /128. An address followed by a dotted mask, separated by a space or a slash, is converted to a prefix by counting the mask's one bits. Masks whose one bits are not contiguous are rejected.
  2. Network and last address. The first bits of the address, as many as the prefix length, are kept. Setting the remaining host bits to zero gives the network address, setting them to one gives the last address of the block. If the address you typed had host bits set, the calculator says so.
  3. Counts. A block has 2 to the power of its host bits addresses. In IPv4, the network and broadcast addresses are reserved, as RFC 1122 requires, so usable hosts are two fewer. A /31 follows RFC 3021: both addresses are usable on a point-to-point link. A /32 is one host. IPv6 has no broadcast address (RFC 4291), so every address counts.
  4. Masks. The netmask, wildcard and binary mask are derived from the prefix for IPv4.
  5. Reverse zone. For IPv4, the zone exists when the prefix is a multiple of 8, built from the network's octets in reverse order under in-addr.arpa (RFC 1035). For IPv6, it exists when the prefix is a multiple of 4, built from the nibbles in reverse order under ip6.arpa (RFC 3596).
  6. Special-purpose range. The network address is compared with the IANA IPv4 and IPv6 Special-Purpose Address Registries, plus the IPv6 address space blocks reserved by the IETF. The most specific matching range wins, and its Globally Reachable value is shown.
  7. Split. For any prefix up to 16 bits longer than the block's, the calculator counts the subnets and lists the first 256. The default split is two bits longer, which gives four subnets.

The range check reads the network address only. A block wider than the special range it starts in is described by its first address: 192.168.0.0/15 shows Private-Use, yet its second half, 192.169.0.0/16, is public space.

Worked examples

Input Network and mask Usable range Usable hosts Notes
192.168.1.0/24 192.168.1.0, 255.255.255.0 192.168.1.1 to 192.168.1.254 254 Broadcast 192.168.1.255. Private-Use (RFC 1918). Zone 1.168.192.in-addr.arpa.
192.168.1.10 255.255.255.0 192.168.1.0/24 192.168.1.1 to 192.168.1.254 254 Host bits set: .10 is a host inside the /24.
172.16.5.4/20 172.16.0.0, 255.255.240.0 172.16.0.1 to 172.16.15.254 4,094 Host bits set. Broadcast 172.16.15.255. No single reverse zone: a /20 spans sixteen /24 zones.
10.0.0.0/8 10.0.0.0, 255.0.0.0 10.0.0.1 to 10.255.255.254 16,777,214 Private-Use (RFC 1918). Zone 10.in-addr.arpa.
198.51.100.7/31 198.51.100.6, 255.255.255.254 198.51.100.6 and 198.51.100.7 2 No broadcast (RFC 3021). Documentation range TEST-NET-2 (RFC 5737).
2001:db8::/48 2001:db8::/48 2001:db8:: to 2001:db8:0:ffff:ffff:ffff:ffff:ffff 1,208,925,819,614,629,174,706,176 2 to the power of 80. Documentation (RFC 3849). Zone 0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.

IPv4 CIDR cheat sheet: /8 to /32

The numbers are exact: a prefix of length n leaves 32 - n host bits, and the block holds 2 to that power. Usable hosts subtract the network and broadcast addresses, except on a /31 (RFC 3021) and a /32.

Prefix Netmask Wildcard Total addresses Usable hosts
/8 255.0.0.0 0.255.255.255 16,777,216 16,777,214
/9 255.128.0.0 0.127.255.255 8,388,608 8,388,606
/10 255.192.0.0 0.63.255.255 4,194,304 4,194,302
/11 255.224.0.0 0.31.255.255 2,097,152 2,097,150
/12 255.240.0.0 0.15.255.255 1,048,576 1,048,574
/13 255.248.0.0 0.7.255.255 524,288 524,286
/14 255.252.0.0 0.3.255.255 262,144 262,142
/15 255.254.0.0 0.1.255.255 131,072 131,070
/16 255.255.0.0 0.0.255.255 65,536 65,534
/17 255.255.128.0 0.0.127.255 32,768 32,766
/18 255.255.192.0 0.0.63.255 16,384 16,382
/19 255.255.224.0 0.0.31.255 8,192 8,190
/20 255.255.240.0 0.0.15.255 4,096 4,094
/21 255.255.248.0 0.0.7.255 2,048 2,046
/22 255.255.252.0 0.0.3.255 1,024 1,022
/23 255.255.254.0 0.0.1.255 512 510
/24 255.255.255.0 0.0.0.255 256 254
/25 255.255.255.128 0.0.0.127 128 126
/26 255.255.255.192 0.0.0.63 64 62
/27 255.255.255.224 0.0.0.31 32 30
/28 255.255.255.240 0.0.0.15 16 14
/29 255.255.255.248 0.0.0.7 8 6
/30 255.255.255.252 0.0.0.3 4 2
/31 255.255.255.254 0.0.0.1 2 2
/32 255.255.255.255 0.0.0.0 1 1

Each step of one bit halves the block. Two /25s make a /24, four /26s make a /24, and a /22 holds four /24s.

IPv6 prefix sizes: /48, /56 and /64

IPv6 blocks are counted in subnets, not hosts: a single /64 holds 18,446,744,073,709,551,616 addresses, far more than any LAN needs. What matters is how many /64s a block contains.

Prefix /64 subnets inside Typical use
/32 4,294,967,296 A provider-scale block. The documentation range 2001:db8::/32 has this size.
/48 65,536 A site, often a business. RIPE-690 suggests it for business customers.
/56 256 A home or small site. RFC 6177 gives /56 as an example of a home assignment smaller than a /48.
/64 1 One LAN or VLAN. Required for stateless autoconfiguration on common links.
/127 not applicable A link between two routers, under RFC 6164.
/128 not applicable A single address, such as a loopback.

What the standards say:

  • RFC 4291 requires 64-bit interface identifiers for unicast addresses outside the range starting with binary 000, which covers the global unicast space. Stateless address autoconfiguration (RFC 4862) builds addresses from such identifiers on common links like Ethernet, so a subnet that should autoconfigure is a /64.
  • RFC 6177 makes no formal recommendation on one exact size. It moves away from the earlier advice of a /48 for every end site, mentions a /56 as a home assignment, recommends giving home sites significantly more than a single /64, and no longer recommends handing out /128s.
  • RIPE-690, the RIPE NCC's best current operational practice for end-user prefixes, offers /48 for business and /56 for residential customers, strongly discourages prefixes longer than /56, and calls a /64 per customer not sustainable because it allows no subnetting.

In the calculator, split a /48 into /64s to see the first 256 of its 65,536 subnets, or into /56s to see all 256 site-sized blocks.

Special-purpose ranges the calculator recognizes

The calculator names the range from the IANA special-purpose registries. The ones you will meet in everyday planning:

Range Name RFC Globally reachable
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 Private-Use RFC 1918 No
100.64.0.0/10 Shared Address Space (CGNAT) RFC 6598 No
127.0.0.0/8 Loopback RFC 1122 No
169.254.0.0/16 Link-Local RFC 3927 No
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 Documentation (TEST-NET-1, 2 and 3) RFC 5737 No
198.18.0.0/15 Benchmarking RFC 2544 No
224.0.0.0/4 Multicast RFC 5771 No
240.0.0.0/4 Reserved RFC 1112 No
::1/128 Loopback Address RFC 4291 No
fc00::/7 Unique-Local RFC 4193 No
fe80::/10 Link-Local Unicast RFC 4291 No
2001:db8::/32, 3fff::/20 Documentation RFC 3849, RFC 9637 No
64:ff9b::/96 IPv4-IPv6 Translation RFC 6052 Yes
2002::/16 6to4 RFC 3056 Yes
ff00::/8 Multicast RFC 4291 No

IPv6 addresses outside 2000::/3 mostly fall in blocks the IETF keeps reserved, so a typo in the first group of an IPv6 address often shows Reserved by IETF. The IP lookup tools reject every range that is not globally reachable, since such an address has no public network to describe.

Splitting a block into subnets

Pick a longer prefix and the calculator lists the subnets in order, with their first and last addresses and their size. Each extra bit doubles the number of subnets and halves their size.

Split Subnets Addresses each Usable hosts each
A /24 into /25 2 128 126
A /24 into /26 4 64 62
A /24 into /27 8 32 30
A /24 into /28 16 16 14
A /24 into /30 64 4 2
A /48 into /56 256 2 to the power of 72 all
A /48 into /64 65,536 2 to the power of 64 all

The list stops at 256 rows; the count above it gives the total. Splits go up to 16 bits longer than the block, so a /8 splits down to /24 and a /48 down to /64.

Common subnetting mistakes

  • Host bits in a route or a rule. 172.16.5.4/20 in a firewall rule means 172.16.0.0/20 to some devices and an error to others. Write the network address.
  • Overlapping plans. Two sites that both use 192.168.1.0/24 cannot be joined by a VPN without renumbering or NAT. Pick distinct blocks from the start, 10.0.0.0/8 leaves plenty of room.
  • Forgetting the two reserved addresses. A /30 holds 4 addresses but only 2 hosts. A /29 holds 8 but only 6.
  • Non-contiguous masks. 255.255.0.255 is not a valid netmask in CIDR. Masks are a run of ones followed by zeros.
  • Blocks that straddle a boundary. A prefix shorter than the range you meant pulls in neighbors, as 192.168.0.0/15 pulls in public space.
  • Numbering a LAN from 100.64.0.0/10. It is reserved for carrier-grade NAT under RFC 6598 and can collide with your provider's addressing.
  • Documentation ranges in production. 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32 exist for examples and are not routed.
  • IPv6 subnets longer than /64 on a LAN. Hosts that rely on stateless autoconfiguration will not configure an address.

Scaling up

The calculator handles one block at a time. For thousands of blocks, the same math is in the standard library of many languages, such as Python's ipaddress module or Go's net/netip package. This Python example prints the same values the calculator shows for 172.16.5.4/20:

python
import ipaddress

block = ipaddress.ip_network("172.16.5.4/20", strict=False)
print("network", block)
print("netmask", block.netmask)
print("wildcard", block.hostmask)
print("broadcast", block.broadcast_address)
print("addresses", block.num_addresses)
print("private", block.is_private)
for subnet in block.subnets(new_prefix=22):
    print(subnet)

Subnet math tells you how a block is shaped, not who holds it. For public addresses, the IP lookup shows the network, location and flags of one address, the ASN lookup describes the network that announces it, and the reverse DNS lookup reads the PTR record your reverse zone serves. To look up many addresses, the bulk page takes a CSV of up to 2,000,000 rows with a free account, and the API's POST /ip answers one address for 1 credit, as the IP endpoint reference and the IP lookup API page describe.

Same check through the API

One HTTPS call, one credit. The response below is the real schema returned by the API.

cURL
curl https://api.qelka.com/v1/ip \
  -H "Authorization: Bearer sk_test_your_key" \
  -H "Content-Type: application/json" \
  -d '{"ip":"8.8.8.8"}'
JavaScript
const response = await fetch("https://api.qelka.com/v1/ip", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_test_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    ip: "8.8.8.8",
  }),
});
const result = await response.json();
{
  "id": "lkp_01M84QZDZHEMMVZCGDFD9ZD53H",
  "object": "ip",
  "input": "8.8.8.8",
  "version": 4,
  "country": {
    "code": "US",
    "name": "United States"
  },
  "region": "California",
  "city": "Mountain View",
  "asn": {
    "number": 15169,
    "org": "Google LLC",
    "type": "hosting"
  },
  "flags": {
    "tor": false,
    "vpn": false,
    "proxy": false,
    "datacenter": true
  },
  "risk": {
    "score": 35,
    "level": "medium"
  },
  "credits_used": 1,
  "cached": false
}

Bulk and pricing

  • Upload a CSV of up to 2,000,000 rows from the dashboard or the API, pick the column, get the results back as a CSV.
  • Every check costs 1 credit, live phone lookups cost 3. Cached results are billed the same way; calls that fail upstream are not billed.
  • The free plan includes 100 credits every month. Paid plans start at $29 for 10,000 credits.

Frequently asked questions

How do I calculate a subnet?
Type the block in CIDR notation, such as 192.168.1.0/24, or an address and its mask, such as 192.168.1.10 255.255.255.0. The calculator keeps the first bits of the address, as many as the prefix length, sets the rest to zero to get the network address and to one to get the last address, then derives the netmask, the usable range and the counts. It works the same way for IPv6.
What does /24 mean in an IP address?
It is the prefix length: the first 24 bits of the address identify the network, and the remaining 8 bits number the hosts inside it. A /24 therefore holds 2 to the power of 8, which is 256 addresses, and its netmask is 255.255.255.0. This notation comes from Classless Inter-Domain Routing, described in RFC 4632, which replaced the old class A, B and C networks.
How many usable hosts are in a /24?
254. A /24 has 256 addresses, and two of them are reserved in an ordinary IPv4 subnet: the first is the network address and the last is the broadcast address. RFC 1122 forbids assigning either to a host. So 192.168.1.0/24 gives hosts 192.168.1.1 to 192.168.1.254, with 192.168.1.255 as the broadcast address.
What is a /31 subnet used for?
Point-to-point links between two routers. A /31 holds exactly two addresses, so there is no room for a separate network and broadcast address. RFC 3021 allows both addresses to be used on point-to-point links, which saves half the space a /30 would take. The calculator follows it: a /31 shows two usable hosts and no broadcast address. A /32 is a single host.
What is a wildcard mask?
The netmask with every bit inverted: 255.255.255.0 becomes 0.0.0.255. The ones mark the bits that may vary, the host part. Router access lists and some routing protocol configurations take wildcard masks instead of netmasks, so the calculator shows both for every IPv4 block. IPv6 configurations use prefix lengths, so it shows no wildcard there.
How do I convert a subnet mask to CIDR notation?
Count the one bits of the mask. 255.255.255.0 is 24 ones followed by zeros, so it is /24. 255.255.240.0 is 20 ones, so /20. You can also type the address and the mask into the calculator, separated by a space or a slash, and it converts them. A mask whose ones are not contiguous, such as 255.255.0.255, is not a valid netmask and is rejected.
What does "host bits are set" mean?
The address you typed is not the first address of its block. In 172.16.5.4/20, the network is 172.16.0.0/20, and 5.4 falls in the host part. The calculator shows the block that contains your address and warns you. Many tools refuse such input, for example Python's ipaddress module raises "has host bits set" unless you pass strict=False.
Which IP address ranges are private?
RFC 1918 reserves three IPv4 blocks for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not reachable from the internet and can be reused by any organization behind NAT. In IPv6, the equivalent is the unique local range fc00::/7 from RFC 4193. The calculator names the range any block falls in and says whether it is globally reachable.
What is the 100.64.0.0/10 range?
The shared address space that RFC 6598 reserves for carrier-grade NAT, between a provider's NAT devices and its subscribers. It is not private space in the RFC 1918 sense and not reachable from the internet. Do not number your own LAN from it: a provider using it on your uplink would collide with your network. The calculator labels it Shared Address Space (CGNAT).
Why is there no broadcast address in IPv6?
Because IPv6 has no broadcast at all. RFC 4291 states that the function of broadcast addresses is superseded by multicast addresses. So the calculator shows no broadcast for an IPv6 block and counts every address in it. One address per subnet is still special: the all-zeros interface identifier is the Subnet-Router anycast address, which you should not assign to a host.
What size IPv6 prefix should a site get?
RFC 6177 sets no single size. It moves away from giving every end site a /48, suggests less than a /48 for home users, such as a /56, and recommends giving home sites significantly more than a single /64. The RIPE NCC's best practice document RIPE-690 suggests /48 for business and /56 for residential customers, and strongly discourages anything longer than /56.
Why are IPv6 subnets /64?
RFC 4291 requires 64-bit interface identifiers for unicast addresses outside the range starting with binary 000, which covers the global unicast space. Stateless address autoconfiguration (RFC 4862) builds an address from such an identifier on common links like Ethernet. A LAN that should autoconfigure therefore needs a /64, however few hosts it has. Router-to-router links can use /127 under RFC 6164.
What is a reverse DNS zone, and why is there none for a /20?
Reverse DNS maps addresses back to names under in-addr.arpa for IPv4 and ip6.arpa for IPv6. Zones split on octets for IPv4 and on 4-bit nibbles for IPv6, so a block gets one zone only when its prefix is a multiple of 8 or 4. A /20 spans sixteen /24 zones. Blocks smaller than a /24 are delegated with the method of RFC 2317.
Does the subnet calculator send my addresses anywhere?
No. Every calculation runs in your browser, in code downloaded with the page. Nothing you type is sent to a server, so you can paste internal ranges and lab addressing plans safely. The tool needs no account and has no daily limit. The IP lookup tools on the site are different: they send the address to our API, because they read network data.

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time