Skip to content

IP Subnet Calculator (IPv4 & IPv6)

Subnet calculator for IPv4 and IPv6: network and broadcast address, mask, wildcard, host range, usable hosts and a subnet splitting table from any CIDR.

Calculator Details

IPv4 network:192.168.1.0/24See results ↓

An IPv4 address (192.168.1.10) or IPv6 address (2001:db8::1). Pasting 10.0.0.0/8 fills in the prefix too.

The number after the slash: /24 is the mask 255.255.255.0. 0–32 for IPv4, 0–128 for IPv6.

A longer prefix to divide the network into equal subnets (e.g. /24 into four /26s). Same or shorter: no split.

Your Results

IPv4 network: 192.168.1.0/24

IPv4 network

192.168.1.0/24

254 usable addresses

Network

Network address

192.168.1.0

Broadcast address

192.168.1.255

First usable

192.168.1.1

Last usable

192.168.1.254

Subnet mask

255.255.255.0

Wildcard mask

0.0.0.255

Total addresses

256 (2^8)

Usable hosts

254

Address

Address entered

192.168.1.0 (the network address)

Type

Private (RFC 1918)

Historic class

Class C

Hex

0xC0A80100

Subnets

4 × /26

62 usable each

192.168.1.0/24 has 256 addresses, 254 usable (192.168.1.1 to 192.168.1.254). It splits into 4 /26 subnets.

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

4 subnets of /26

4 subnets of /26
#SubnetFirst usableLast usableBroadcast
1192.168.1.0/26192.168.1.1192.168.1.62192.168.1.63
2192.168.1.64/26192.168.1.65192.168.1.126192.168.1.127
3192.168.1.128/26192.168.1.129192.168.1.190192.168.1.191
4192.168.1.192/26192.168.1.193192.168.1.254192.168.1.255

How This Calculator Works

How the Subnet Is Calculated

Mask = 24 one-bits followed by 8 zero-bits
Network = address AND mask · Wildcard = NOT mask
Broadcast = network OR wildcard · Total addresses = 2^(32 − prefix)
Usable = total − 2 (network and broadcast) for /0–/30; /31 = 2 (RFC 3021); /32 = 1
Address 11000000.10101000.00000001.00000000 = 192.168.1.0
Mask    11111111.11111111.11111111.00000000 = 255.255.255.0
Network = 192.168.1.0 · Broadcast = 192.168.1.255
Total = 2^8 = 256 · usable = 254
Split /24 → /26: 2^(26 − 24) = 4 subnets of 64 addresses

IPv6 addresses are shown in the RFC 5952 short form: lower case, leading zeros dropped and the longest run of zero groups written as “::”. The address type comes from the IANA special-purpose address registries.

Frequently Asked Questions

What is CIDR notation?

Classless Inter-Domain Routing (RFC 4632) writes a network as an address, a slash and a prefix length, such as 192.168.1.0/24. The prefix length is the number of leading bits that identify the network; the remaining bits number the hosts inside it. A /24 leaves 8 host bits, so it holds 2^8 = 256 addresses.

How many usable hosts are in a subnet?

For IPv4 prefixes up to /30, usable hosts = 2^(32 − prefix) − 2, because the first address identifies the network and the last is the broadcast address. A /24 has 254 usable hosts, a /27 has 30 and a /30 has 2. A /31 is a special case for point-to-point links (RFC 3021): both of its addresses are usable and it has no broadcast. A /32 is a single host.

What is a wildcard mask?

A wildcard mask is the subnet mask with every bit flipped: 255.255.255.0 becomes 0.0.0.255. Cisco access control lists and OSPF configurations use it, where a 0 bit means “must match” and a 1 bit means “any value”. For a normal subnet the wildcard mask is also the broadcast address minus the network address.

How do I split a network into smaller subnets?

Choose a longer prefix. Each extra bit doubles the number of subnets and halves their size: a /24 splits into two /25s, four /26s or eight /27s. The table lists every subnet with its range, up to the first 256; the total count is shown above the table. To fit a number of hosts, pick the longest prefix whose usable host count is still big enough, e.g. 50 hosts need a /26 (62 usable).

Why doesn’t IPv6 have a broadcast address?

IPv6 (RFC 4291) replaced broadcast with multicast, so every address in a prefix can be assigned and the calculator counts them all as usable. The all-zeros interface address of a subnet is reserved as the Subnet-Router anycast address, and most networks use a /64 for each LAN because stateless address autoconfiguration (SLAAC) needs 64 interface bits.

Which IP addresses are private?

RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks; they are not routed on the internet. 100.64.0.0/10 is shared address space for carrier-grade NAT, 127.0.0.0/8 is loopback and 169.254.0.0/16 is link-local. In IPv6, fc00::/7 holds unique local addresses and fe80::/10 is link-local. The calculator labels every address from the IANA special-purpose registries.

What are IP address classes, and are they still used?

Before 1993, the first bits of an IPv4 address fixed the network size: class A (0–127) used /8, class B (128–191) /16 and class C (192–223) /24, with D for multicast and E reserved. CIDR replaced classes with prefixes of any length, so classes no longer affect routing. The calculator shows the historic class only because older courses and exams still ask for it.

Why did my address change when I entered it?

If the address has host bits set (for example 10.20.30.40/13), the calculator works out the network that contains it by clearing those bits: 10.16.0.0/13. The address you typed is still shown under the results, along with whether it is the network address itself.

CIDR and masks per RFC 4632; IPv4 network and broadcast addresses per RFC 950/919, /31 links per RFC 3021; IPv6 addressing per RFC 4291 and text form per RFC 5952; address types from the IANA IPv4 and IPv6 special-purpose registries. The table lists up to 256 subnets. Variable-length (VLSM) plans with different subnet sizes and zone indexes (fe80::1%eth0) are not supported.

Subnet Calculator: CIDR, Masks and Host Ranges for IPv4 and IPv6

By FindMySum · Last reviewed

A subnet calculator turns an IP address and a prefix length into everything you need to configure a network: the network address, the mask, the range of addresses you can hand out, the broadcast address and how many hosts fit. It also splits a block into smaller equal subnets. This article explains the binary arithmetic behind each figure, works through the calculator's default example, and covers the special cases that trip people up: /31 and /32 prefixes, private ranges, and IPv6.

Addresses are just numbers

An IPv4 address is a 32-bit number written as four bytes in decimal, separated by dots. 192.168.1.0 is the bytes 11000000, 10101000, 00000001 and 00000000. An IPv6 address is a 128-bit number written as eight groups of four hexadecimal digits. Everything a subnet calculator does is bitwise arithmetic on those numbers.

A network is described by a prefix: the first n bits are fixed and identify the network, and the remaining bits vary to number the hosts. Classless Inter-Domain Routing (CIDR, RFC 4632) writes this as the address, a slash and n. In 192.168.1.0/24 the first 24 bits are the network and the last 8 bits are free, so the block holds 2^8 = 256 addresses.

The masks

The subnet mask is n one-bits followed by zeros. For /24 that is 255.255.255.0; for /20 it is 255.255.240.0, because the third byte is 11110000. Combining any address with the mask by a bitwise AND clears the host bits and gives the network address. That is why entering 10.20.30.40 with a /13 prefix returns 10.16.0.0/13: the second byte, 20 (00010100), is cut to its first five bits, 00010000, which is 16.

The wildcard mask is the inverse, zeros where the mask has ones: 0.0.0.255 for a /24. Cisco access lists and OSPF network statements use it. OR-ing the network address with the wildcard mask gives the last address in the block.

Network, broadcast and usable hosts

In IPv4 the first address of a block (all host bits zero) names the network and the last (all host bits one) is the directed broadcast address, so neither is given to a device. The usable count for prefixes up to /30 is therefore:

usable hosts = 2^(32 − n) − 2

Two prefixes are exceptions. A /31 has only two addresses, and losing both to network and broadcast would make it useless, so RFC 3021 lets point-to-point links use both with no broadcast. A /32 is a single address, used for loopbacks and host routes. The calculator applies both rules.

Worked example: the default 192.168.1.0/24

The calculator opens with 192.168.1.0 and a /24 prefix, split into /26 subnets.

  • Mask: 24 ones, so 255.255.255.0; wildcard 0.0.0.255.
  • Network: 192.168.1.0. Broadcast: 192.168.1.255.
  • Host range: 192.168.1.1 to 192.168.1.254, which is 254 usable addresses out of 256.
  • Type: private, because it falls in 192.168.0.0/16 from RFC 1918.

Splitting into /26 borrows 2 more bits for the network, giving 2^2 = 4 subnets of 2^6 = 64 addresses each, 62 usable:

SubnetUsable rangeBroadcast
192.168.1.0/26.1 to .62.63
192.168.1.64/26.65 to .126.127
192.168.1.128/26.129 to .190.191
192.168.1.192/26.193 to .254.255

Each extra prefix bit doubles the number of subnets and halves their size. The table on the page lists up to 256 subnets and always states the full count.

IPv6 works the same way, with bigger numbers

IPv6 subnetting uses the identical AND-with-mask arithmetic over 128 bits, but RFC 4291 removed broadcast entirely, so every address in a prefix is usable. The calculator shows the network in the short text form from RFC 5952: lower-case hex, leading zeros dropped in each group, and the longest run of two or more zero groups replaced by "::". 2001:0db8:abcd:0012:0000:0000:0000:0000 becomes 2001:db8:abcd:12::.

Address counts get large quickly. A single /64 LAN subnet holds 2^64, about 1.8 × 10^19 addresses, which is why IPv6 planning is about the number of subnets rather than the number of hosts. Splitting the /64 in the calculator into /66s gives four subnets of about 4.6 × 10^18 addresses each, though in practice LANs should stay at /64.

Special-purpose ranges

Not every address is meant for the public internet. The calculator labels each address from the IANA special-purpose registries, including the RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16), carrier-grade NAT space (100.64.0.0/10), loopback (127.0.0.0/8 and ::1), link-local (169.254.0.0/16 and fe80::/10), the documentation ranges used in examples (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32), IPv6 unique local addresses (fc00::/7) and multicast. Anything outside those IPv4 blocks is public unicast.

The page also shows the historic class (A to E) of an IPv4 address. Classes stopped mattering for routing when CIDR arrived in 1993, but networking courses and certification exams still ask for them.

More questions

How do I choose a prefix for a given number of hosts?

Add two to the number of hosts you need (for the network and broadcast addresses), round up to the next power of two, and subtract that power's exponent from 32. Forty hosts need 42 addresses, which rounds up to 64 = 2^6, so the prefix is 32 − 6 = /26 with 62 usable addresses. Leave room for growth: renumbering a full subnet later is far more work than starting one size larger.

Can two subnets overlap?

Not if they are allocated from the same address plan, and routers will reject or misroute overlapping networks on directly connected interfaces. Two CIDR blocks either do not overlap at all or one contains the other entirely, because every block starts on a multiple of its own size. A splitting table like the one on this page always produces subnets that sit side by side with no gaps and no overlaps.

What is the difference between a subnet mask and a prefix length?

They carry the same information in two notations. The prefix length counts the leading one-bits; the mask writes those bits out as a dotted-decimal address. /24 and 255.255.255.0 are the same thing, as are /20 and 255.255.240.0. Masks must be contiguous: a mask such as 255.0.255.0 is not valid for subnetting, which is one reason the prefix form has largely replaced it.

Why is a /64 the standard IPv6 subnet size?

IPv6 addresses are split into a 64-bit network part and a 64-bit interface identifier. Stateless address autoconfiguration (SLAAC), privacy addresses and several neighbour discovery features assume that split, so a LAN subnet smaller than /64 breaks them. Internet providers commonly give a home a /56 or /48, which leaves 256 or 65,536 /64 subnets to use inside it.

What is supernetting or route summarisation?

It is subnetting in reverse: combining adjacent blocks into one shorter prefix so a router can advertise a single route. Four networks 10.1.0.0/24 to 10.1.3.0/24 summarise to 10.1.0.0/22, because they share their first 22 bits. Summaries only work when the blocks are contiguous and start on a boundary of the combined size.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy