SUBNET CALCULATOR

Subnet calculator

Enter an IPv4 address and a prefix or mask. Get the network, broadcast, usable range and more, or split the network into subnets.

The prefix can also follow the address (192.168.1.130/26); then this box is ignored. A mask must have its ones first.

What a subnet calculator tells you

An IPv4 address is a 32-bit number written as four numbers from 0 to 255. A prefix length such as /26 says how many of the leading bits name the network; the remaining bits number the hosts inside it. From an address and a prefix (or a dotted subnet mask) this page works out the network address, the broadcast address, the first and last usable host, how many addresses and hosts the subnet holds, the wildcard mask, the binary form, the historical class and the special-purpose block the range belongs to, if any. The other two modes cut a network into equal subnets, or find the smallest prefix for a number of hosts and lay out a plan for several subnets at once.

How the numbers are worked out

The mask is p ones followed by 32 − p zeros. The address ANDed with the mask is the network address; the network address with every host bit set to 1 is the broadcast address. The block holds 2^(32 − p) addresses, which is the table of block sizes in RFC 4632 (a /32 is one address, a /8 is 16,777,216); RFC 1878 lists the matching masks. Up to /30 the all-zeros host number is the network itself and the all-ones host number is the broadcast, so usable hosts = 2^(32 − p) − 2. A /31 has both addresses usable on a point-to-point link (RFC 3021), and a /32 is a single host route.

Worked example: 192.168.1.130/26

26 ones make the mask 255.255.255.192 and the wildcard 0.0.0.63. The block size is 64, and 130 lies in the block that starts at 128 (2 × 64), so the network address is 192.168.1.128 and the broadcast address is 192.168.1.191. The usable hosts run from 192.168.1.129 to 192.168.1.190, 62 in all. The network sits inside 192.168.0.0/16, “Private-use” (RFC 1918). To split 192.168.1.0/24 into four subnets, borrow 2 bits: the subnets are 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, 192.168.1.192/26.

A VLSM plan for 100, 50, 25, 10 and 2 hosts

Fixed-size subnets waste addresses when the needs differ. Variable-length subnet masking gives each subnet only the size it needs, largest first so that every block stays aligned. Inside 192.168.1.0/24 the plan is 192.168.1.0/25 for 100 hosts; 192.168.1.128/26 for 50 hosts; 192.168.1.192/27 for 25 hosts; 192.168.1.224/28 for 10 hosts; 192.168.1.240/30 for 2 hosts. That leaves 12 addresses unused. Choose the “Fit hosts” mode and type the list to get your own plan.

Prefix length reference

PrefixSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

Sizes follow RFC 4632 and RFC 1878; usable counts apply the rules above. The reference rows come from the same functions as the calculator.

Special-purpose blocks the calculator recognizes

BlockNameDocument
0.0.0.0/8“This network”RFC 791 §3.2
0.0.0.0/32“This host on this network”RFC 1122 §3.2.1.3
10.0.0.0/8Private-useRFC 1918
100.64.0.0/10Shared address space (carrier-grade NAT)RFC 6598
127.0.0.0/8LoopbackRFC 1122 §3.2.1.3
169.254.0.0/16Link-localRFC 3927
172.16.0.0/12Private-useRFC 1918
192.0.0.0/24IETF protocol assignmentsRFC 6890 §2.1
192.0.2.0/24Documentation (TEST-NET-1)RFC 5737
192.88.99.0/24Deprecated 6to4 relay anycastRFC 7526
192.168.0.0/16Private-useRFC 1918
198.18.0.0/15BenchmarkingRFC 2544
198.51.100.0/24Documentation (TEST-NET-2)RFC 5737
203.0.113.0/24Documentation (TEST-NET-3)RFC 5737
224.0.0.0/4MulticastRFC 1112, RFC 5771
240.0.0.0/4Reserved for future useRFC 1112 §4
255.255.255.255/32Limited broadcastRFC 919 §7, RFC 8190

From the IANA IPv4 Special-Purpose Address Registry (read October 27, 2026), plus multicast (RFC 1112, RFC 5771), which IANA keeps in its multicast registry. A block missing from this list is not necessarily a public address you may use; the registry only says it has no special purpose.

Common mistakes

Mixing up the host address and the network address: 192.168.1.130/26 is not a network, the network is 192.168.1.128/26. Reading the address class as the mask: classes A, B and C (RFC 791) and D and E (RFC 1112) are historical, and RFC 4632 replaced them with explicit prefixes, so 10.1.0.0/16 is a perfectly good /16 even though 10.x.x.x was a Class A. Using a /31 on a LAN, which RFC 3021 does not cover. Typing a mask like 255.0.255.0, whose ones are not contiguous; the calculator rejects it. Writing leading zeros, as in 192.168.001.010: POSIX inet_addr() treats a leading 0 as octal, so the same text can mean different addresses in different programs, and the calculator asks for plain decimal numbers.

What does /24 mean?

It is the prefix length: the first 24 of the 32 bits of the address name the network and the other 8 identify a host. The mask is 24 ones followed by 8 zeros, 255.255.255.0 in dotted form, and the block holds 256 addresses. CIDR notation, a four-number address followed by a slash and a number from 0 to 32, is defined in RFC 4632, section 3.1; its example is the legacy Class B network 172.16.0.0, which becomes 172.16.0.0/16.

Why does a /24 have 254 usable hosts and not 256?

Two of the 256 addresses are reserved. The address whose host bits are all zeros names the network itself, and the one whose host bits are all ones is the broadcast address of the subnet. RFC 4632 counts a legacy Class C network as 254 end systems: “256 bit combinations minus the reserved all-zeros and all-ones patterns.” The same rule gives 2 usable hosts in a /30, 62 in a /26 and 16,777,214 in a /8.

How do /31 and /32 work?

A /31 has only 2 addresses. RFC 3021 allows it on point-to-point links: the two addresses that would be the network and broadcast addresses “MUST be interpreted as host addresses,” so a router-to-router link uses 2 addresses instead of 4 (the RFC’s example is 500 links saving 1,000 addresses). Do not use a /31 on an ordinary LAN; RFC 3021 considers only point-to-point links. A /32 is a single address, a host route: RFC 4632’s table calls it that, and the calculator reports 1 usable address.

How do I split a network into subnets?

Borrow host bits: each extra bit of prefix doubles the number of subnets and halves their size. 192.168.1.0/24 needs 2 more bits for 4 subnets, giving four /26 blocks, 192.168.1.0/26, 192.168.1.64/26, 192.168.1.128/26, 192.168.1.192/26, each with 62 usable hosts. If you ask for a number that is not a power of two, such as 5, the calculator rounds up to the next one (8). RFC 950 (1985) advised against using the subnets whose subnet field is all zeros or all ones, but RFC 1878 (1995) lists them as usable, citing RFC 1812, and so does this calculator.

How many hosts fit in each prefix, and which one do I need?

Pick the longest prefix whose usable count covers your hosts: 254 hosts need a /24, 255 hosts already need a /23 (510 usable), 1,000 need a /22 (1,022), and two devices on a cable need a /30 (or a /31 on a point-to-point link). The “Fit hosts” mode does this and, if you give a list of host counts, lays the subnets out inside your network with the largest first (VLSM).

Which addresses are private?

RFC 1918 sets aside three blocks for private use: 10.0.0.0/8 (10.0.0.0 to 10.255.255.255), 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. Shared address space 100.64.0.0/10 (RFC 6598) is a separate block meant for carrier-grade NAT on service-provider networks, not for home or office LANs. 169.254.0.0/16 is link-local (RFC 3927), used when a host cannot get an address any other way. The calculator labels the address with the narrowest block of the IANA special-purpose registry that contains it.

What is a wildcard mask?

It is the subnet mask with every bit flipped: 255.255.255.192 becomes 0.0.0.63. The ones mark the host part, the zeros the network part. Some router configuration languages ask for this form instead of the subnet mask; the network and broadcast addresses come from it too, since broadcast = network OR wildcard.

Does it work for IPv6?

No, this page is IPv4 only. For orientation: RFC 4291, section 2.5.1, requires the interface identifier of an IPv6 unicast address to be 64 bits long (except for addresses that start with the bits 000), which is why a single IPv6 LAN is normally a /64, with 2^64 = 18,446,744,073,709,551,616 addresses. How much space to hand a site is left to the operators: RFC 6177 obsoleted the old advice to give every site a /48 and says that anything of /64 or shorter works from a standards perspective.

Sources: RFC 4632 (CIDR, sections 2 and 3.1); RFC 950 (Internet standard subnetting procedure); RFC 1878 (variable length subnet table); RFC 791 (classes); RFC 1112 (class D and E); RFC 1918 (private address space); RFC 3021 (31-bit prefixes on point-to-point links); RFC 3927 (link-local); RFC 5737 (documentation blocks); RFC 6598 (shared address space); RFC 919 and RFC 8190 (limited broadcast); IANA IPv4 Special-Purpose Address Registry; RFC 4291 section 2.5.1 and RFC 6177 (IPv6). Related: binary converter, number base converter and hex calculator for bit-level work, download time calculator and RAID calculator for the other numbers in a network or server build.