Subnet Calculator – IP Subnet Mask & CIDR Calculator

Free subnet calculator and CIDR calculator: enter an IPv4 address with a prefix or subnet mask to get the network address, broadcast address, usable host range, wildcard mask, IP class and reverse-DNS zone, split a network into subnets with VLSM, convert between a CIDR block and an IP range, and check IPv6 subnets too.

Enter an IPv4 address with a prefix or subnet mask.

Runs in your browser. No IP address, range or CIDR block you enter is sent to our servers or saved; only the active tab is remembered.

How to use the subnet calculator

  • Subnet info: type an IPv4 address with a prefix (192.168.1.10/24), a mask (192.168.1.10 255.255.255.0), or a CIDR block (192.168.1.0/24) in one field, or split the prefix/mask into the second field. You get the network, broadcast, usable host range, subnet and wildcard masks, IP class, address type (private/public/reserved), binary and hex views, and the in-addr.arpa reverse-DNS zone.
  • Split subnets: enter a base network, then split it evenly into a chosen number of subnets, or by the number of hosts each subnet needs (VLSM) — paste one label,hosts line per requirement and they are packed largest-first with no overlap.
  • Range ↔ CIDR: enter a start and end address to get the smallest list of CIDR blocks covering that range. To go the other way — CIDR block to IP range — use the Subnet info tab.
  • IPv6: enter an IPv6 address and prefix length to get the network, first and last address, and the exact address count.

What is a subnet mask?

An IPv4 address is 32 bits split into a network part and a host part. A subnet mask marks that split: it is 32 bits too, with a 1 for every network bit and a 0 for every host bit, written in the same dotted-quad form as an address. 255.255.255.0 means the first 24 bits are the network and the last 8 are hosts — the same information as writing /24 after the address.

Applying the mask (address AND mask) to any address in the subnet gives the same network address. For 192.168.1.10/24:

IP address11000000.10101000.00000001.00001010192.168.1.10
Subnet mask11111111.11111111.11111111.00000000255.255.255.0
Network (AND)11000000.10101000.00000001.00000000192.168.1.0

Because 192.168.1.10 has non-zero bits in the host part, it is a host address inside 192.168.1.0/24, not the network address itself — the calculator flags this whenever it happens.

How many hosts fit in each prefix? A non-octet example

Prefixes that don't land on an 8-bit boundary work the same way. 192.168.1.40/27 uses mask 255.255.255.224 (only the last octet is split): the block runs from 192.168.1.32 to 192.168.1.63, giving 30 usable hosts, 192.168.1.33 to 192.168.1.62. A smaller /30 such as 10.0.0.4/30 fits exactly 2 hosts — the classic size for a point-to-point link when a full /31 isn't used.

What is CIDR notation?

CIDR (Classless Inter-Domain Routing, RFC 4632) replaced the rigid class-based system (Class A = /8, B = /16, C = /24) with an address plus an explicit prefix length, e.g. 192.168.1.10/24. Any prefix length from /0 (the whole internet) to /32 (one address) is valid, which is what lets internet service providers and cloud platforms hand out blocks sized to what a customer actually needs instead of the nearest class boundary.

Splitting a network into subnets (VLSM)

Splitting 192.168.1.0/24 into 4 equal subnets moves the prefix from /24 to /26 (2 extra bits = 4 blocks), each with 62 usable hosts:

SubnetCIDRUsable range
1192.168.1.0/26192.168.1.1 – 192.168.1.62
2192.168.1.64/26192.168.1.65 – 192.168.1.126
3192.168.1.128/26192.168.1.129 – 192.168.1.190
4192.168.1.192/26192.168.1.193 – 192.168.1.254

Real networks rarely need equal-sized subnets. Variable Length Subnet Masking (VLSM) gives each department or link only the block it needs: a 100-host office gets a /25, a 50-host one a /26, and a 2-host router link a /30, packed into the base network without gaps or overlap. The "Split subnets" tab does this automatically — list each requirement as label,hosts and it sorts largest-first and allocates each the smallest block that fits.

CIDR to IP range and IP range to CIDR

Converting a CIDR block to a range is direct — the calculator gives it on the Subnet info tab. The reverse is not always one block: a range only maps to a single CIDR block when it starts on a power-of-two boundary and its length is itself a power of two. 192.168.1.5–192.168.1.20 needs 5 blocks:

CIDR blockAddresses
192.168.1.5/321
192.168.1.6/312
192.168.1.8/298
192.168.1.16/304
192.168.1.20/321

Private vs public IP addresses

RFC 1918 sets aside three ranges for private networks never routed on the public internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. A few other ranges have special jobs: 127.0.0.0/8 is loopback, 169.254.0.0/16 is link-local (self-assigned when DHCP fails), 224.0.0.0/4 is multicast, and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are documentation-only ranges, like the examples on this page. The calculator flags all of these under "Address type".

IPv6 subnetting

IPv6 addresses are 128 bits, written as eight hex groups with :: allowed once to compress a run of zero groups. A home allocation is typically a /64 — 264 addresses, more than every IPv4 address ever issued, in one subnet — while an ISP customer often gets a /56 or /48 to split into many /64s. The IPv6 tab gives the network, first/last address and the exact address count as a full integer (JavaScript numbers can't hold it exactly, so it uses arbitrary-precision arithmetic).

Subnet cheat sheet: every prefix /0 to /32

Every prefix length, its mask, wildcard mask, and address/host counts — generated by the same engine as the calculator above, so it always matches:

PrefixSubnet maskWildcard maskTotal addressesUsable hosts
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/3224.0.0.031.255.255.255536,870,912536,870,910
/4240.0.0.015.255.255.255268,435,456268,435,454
/5248.0.0.07.255.255.255134,217,728134,217,726
/6252.0.0.03.255.255.25567,108,86467,108,862
/7254.0.0.01.255.255.25533,554,43233,554,430
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122
/32255.255.255.2550.0.0.011

Reverse DNS and the in-addr.arpa zone

Reverse DNS (an IP address to a hostname, via a PTR record) is served from the in-addr.arpa zone, with the address octets reversed: 192.168.1.0/24 is delegated in 1.168.192.in-addr.arpa, and the whole 10.0.0.0/8 block is 10.in-addr.arpa. Prefixes off an octet boundary (like /27) are delegated within their containing /24 (RFC 2317), so the calculator shows that whole-octet zone for those.

Other developer and sysadmin tools

  • Chmod calculator: the other half of sysadmin work — set Linux/Unix file permissions, convert octal to symbolic, and build the exact chmod command.
  • JWT decoder: decode a JSON Web Token and check its claims and expiry.
  • JSON formatter and validator: format and validate API responses and config files.

Frequently asked questions

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) notation writes a network as an address plus a slash and a prefix length, e.g. 192.168.1.10/24, where the number after the slash is how many leading bits of the 32-bit address are the network part. It replaced the older class-based system (Class A/B/C) because it lets a network be any size, not just /8, /16 or /24.

How many hosts are in a /24?

A /24 has 256 total addresses and 254 usable hosts: 192.168.1.1 to 192.168.1.254. The first address (192.168.1.0) is the network address and the last (192.168.1.255) is the broadcast address, so both are reserved and not assigned to a device.

What is a subnet mask, and how is it different from a CIDR prefix?

They describe the same split between network bits and host bits in two notations: a subnet mask is a dotted-quad with as many leading 1 bits as the prefix (255.255.255.0 for /24), and a CIDR prefix is just that bit count written after a slash (/24). The calculator accepts either and shows both.

What is a wildcard mask?

A wildcard mask is the inverse of a subnet mask (each bit flipped) — 0.0.0.255 for a /24 mask of 255.255.255.0. Cisco access control lists and OSPF network statements use wildcard masks instead of subnet masks, so the calculator shows both for every prefix.

Why does 192.168.1.0/24 have only 254 usable hosts instead of 256?

A /24 has 256 total addresses, but the first (the network address, .0) identifies the subnet itself and the last (the broadcast address, .255) sends to every host on it — neither can be assigned to a device. The two exceptions are /31, used for point-to-point links with no broadcast (RFC 3021, both addresses usable), and /32, a single host route.

What is VLSM (Variable Length Subnet Masking)?

VLSM splits one network into subnets of different sizes instead of equal ones, so a network with a 100-host department and a 2-host router link does not waste addresses giving both the same size block. The "Split subnets" tab above does this: enter each requirement’s host count and it packs the smallest subnet that fits each one, largest first, with no overlap.

What is a private IP address?

Private addresses (Private use (RFC 1918), e.g. 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) are reserved for use inside a network and never routed on the public internet; a router performs NAT so they can reach the internet through one public address. Compare a public address like 8.8.8.8 (Public (globally routable)), a loopback address like 127.0.0.1 (Loopback (RFC 1122)), or a link-local address like 169.254.1.5 (Link-local (RFC 3927)), which a device picks for itself when DHCP fails.

What is the difference between a network address and a broadcast address?

The network address (all host bits zero, e.g. 192.168.1.0) identifies the subnet as a whole and is used in routing tables. The broadcast address (all host bits one, e.g. 192.168.1.255) is a special destination that every host on the subnet receives. Both are set aside automatically and excluded from the usable host range.

How do I convert a CIDR block to an IP address range, or the other way round?

Enter the CIDR block (e.g. 192.168.1.0/24) in the Subnet info tab to see its first and last usable address. To go the other way, use the Range ↔ CIDR tab: enter a start and end address and it returns the smallest list of CIDR blocks that exactly covers that range, since a range does not always align to a single power-of-two block.

Does this calculator support IPv6?

Yes, as a bonus tab: enter an IPv6 address and a prefix length (0–128) to get the network, first and last address, and the exact number of addresses in the block as a full integer (IPv6 blocks are astronomically larger than IPv4 ones, so the count is shown in full rather than rounded).

This tool computes standard IPv4/IPv6 subnetting arithmetic from RFC 791, 950, 1918 and 4632. Double-check any address you plan to deploy against your network's actual routing and firewall rules. Spotted a wrong result? Tell us. Last reviewed .