IPv4 Subnet Calculator - CIDR, Netmask, Wildcard, Host Range and Subnet Splitter

Type an IPv4 address with a prefix (192.168.1.10/24) or a mask (192.168.1.10 255.255.255.0, or a wildcard mask) and see the network, broadcast address, netmask, wildcard mask, first and last usable host, address count, address type and binary view.

About this tool

Then split the network into equal subnets or by hosts needed, or turn a start and end address into the fewest CIDR blocks. IPv4 only, calculated in your browser.

How it works

An IPv4 address is a 32 bit number written as four bytes. A prefix length such as /24 says how many leading bits name the network. The rest identify hosts on it. The netmask is that many 1 bits followed by 0 bits (/24 is 255.255.255.0), and the wildcard mask, which some router configurations use, is the same mask turned upside down (0.0.0.255). The network address is the address AND the netmask. The broadcast address is the network address OR the wildcard mask. A prefix of length n holds 2 to the power of (32 - n) addresses: 256 for a /24, which is 254 usable hosts once the network and broadcast addresses are taken out. This notation is CIDR (RFC 4632). It replaced the old classes A, B and C that RFC 791 defined by the first bits of an address. The tool still shows the class for reference.

Two prefixes break the minus-two rule. RFC 3021 lets a point-to-point link use a /31: both addresses are hosts, with no network or broadcast address. A /32 is a single address, used as a host route or to name one device. The tool shows a /31 as 2 usable hosts and a /32 as 1. You can type the size as /24, as a netmask (192.168.1.10 255.255.255.0) or as a wildcard mask (192.168.1.10 0.0.0.255). A mask is read as a netmask if it is a valid one, and as a wildcard mask if only that fits. 0.0.0.0 and 255.255.255.255 fit both ways, so Detect reads them as netmasks and you can switch it. If the address has host bits set, as 192.168.1.10/24 does, the tool shows the network that contains it.

The address type comes from the IANA IPv4 special-purpose address registry. The private ranges of RFC 1918 are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Loopback is 127.0.0.0/8 (RFC 1122). Link-local addresses, which a device gives itself when it has no other configuration, are 169.254.0.0/16 (RFC 3927). 100.64.0.0/10 is the shared address space used for carrier-grade NAT (RFC 6598). 224.0.0.0/4 is multicast (RFC 5771) and 240.0.0.0/4 is reserved for future use (RFC 1112). The documentation ranges 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are for examples (RFC 5737), and 198.18.0.0/15 is for benchmarking (RFC 2544). An address in none of these blocks is shown as ordinary public space, which does not mean that anyone has been allocated it.

Splitting into equal subnets adds bits to the prefix. Each extra bit doubles the number of subnets and halves their size, so a /24 split into four gives four /26 blocks of 64 addresses and 62 usable hosts. The hosts-needed mode is variable length subnet masking (VLSM). Each requirement is rounded up to the smallest block that holds that many hosts plus the network and broadcast addresses, so 100 hosts need 102 addresses, which means a /25 of 128. The blocks are placed from the start of the network, biggest first, so each sits on its natural boundary, and what is left over is listed as the fewest CIDR blocks.

The range to CIDR mode finds the fewest CIDR blocks that cover exactly the addresses from the first to the last. At each step it takes the biggest block that starts at the current address, sits on its own size boundary and does not run past the end. A range rarely lines up with one prefix: 192.168.1.5 to 192.168.1.200 needs nine blocks. The arithmetic uses unsigned 32 bit numbers throughout, so addresses above 127.255.255.255 are handled correctly. IPv6 is not covered.

Worked examples

192.168.1.10/24

The network is 192.168.1.0 and the broadcast address is 192.168.1.255. The netmask is 255.255.255.0 and the wildcard mask is 0.0.0.255. The usable hosts run from 192.168.1.1 to 192.168.1.254: 254 of the 256 addresses. The address is a private RFC 1918 address, and 192.168.1.10 is an ordinary host in it.

172.16.5.4 with the mask 255.255.240.0

The mask has 20 leading 1 bits, so it is /20. The third byte is 5 AND 240, which is 0, so the network is 172.16.0.0. The broadcast address is 172.16.15.255, and the block holds 4,096 addresses and 4,094 usable hosts. All of it is inside the private range 172.16.0.0/12.

203.0.113.5/31

A /31 holds 203.0.113.4 and 203.0.113.5. Under RFC 3021 both are usable hosts on a point-to-point link, with no network or broadcast address. The block is inside 203.0.113.0/24, the TEST-NET-3 documentation range of RFC 5737.

Splitting 192.168.10.0/24 into four

Choose /26. The subnets are 192.168.10.0/26, 192.168.10.64/26, 192.168.10.128/26 and 192.168.10.192/26. Each has 64 addresses and 62 usable hosts. The first has hosts 192.168.10.1 to 192.168.10.62 and the broadcast address 192.168.10.63.

Hosts needed: 100, 50, 20 and 10 in 192.168.1.0/24

100 hosts need a /25 (126 usable), 50 need a /26 (62), 20 need a /27 (30) and 10 need a /28 (14). They are placed as 192.168.1.0/25, 192.168.1.128/26, 192.168.1.192/27 and 192.168.1.224/28, which use 240 of the 256 addresses. The remaining 192.168.1.240/28 is still free.

An IP range to CIDR blocks

192.168.1.5 to 192.168.1.200 is 196 addresses, covered by nine blocks: 192.168.1.5/32, 192.168.1.6/31, 192.168.1.8/29, 192.168.1.16/28, 192.168.1.32/27, 192.168.1.64/26, 192.168.1.128/26, 192.168.1.192/29 and 192.168.1.200/32.

Every IPv4 prefix length with its netmask, wildcard mask and size

PrefixNetmaskWildcard 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

Frequently asked questions

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

They are the same mask with every bit flipped. A netmask such as 255.255.255.0 has 1 bits for the network part. The wildcard mask 0.0.0.255 has 1 bits for the host part. Some router configurations ask for the wildcard form, so the calculator shows both.

How many usable hosts are in a /24, a /26 and a /30?

A /24 has 256 addresses and 254 usable hosts. A /26 has 64 addresses and 62 usable hosts. A /30 has 4 addresses and 2 usable hosts. The rule is 2 to the power of (32 minus the prefix), minus 2 for the network and broadcast addresses.

Why do you subtract 2 from the number of addresses?

The first address of a subnet names the network and the last one is the broadcast address, so neither is given to a host. That is true for a /30 and shorter prefixes. A /31 and a /32 are the exceptions that RFC 3021 and host routes describe.

What are a /31 and a /32?

A /31 has two addresses. RFC 3021 allows both to be used as hosts on a point-to-point link, so there is no network or broadcast address. A /32 is one address, used as a host route or to name a single device such as a loopback interface.

Which IPv4 ranges are private?

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16 for private networks. These addresses are not routed on the public internet. 100.64.0.0/10 is a separate shared range for carrier-grade NAT (RFC 6598), and 169.254.0.0/16 is link-local (RFC 3927).

What does 169.254.x.x mean?

It is a link-local address from 169.254.0.0/16 (RFC 3927). A device picks one for itself when it has no other address configuration, for example when it cannot reach a DHCP server. It works only on the local link and is not routed.

What is the 100.64.0.0/10 range?

RFC 6598 reserves 100.64.0.0/10 as shared address space for carrier-grade NAT, where an internet provider shares public addresses between customers. It is not one of the RFC 1918 private ranges and it is not ordinary public space. Because the block is set aside for the link between a provider's CGN devices and customer equipment, it is a poor choice for your own private network.

How do I turn an IP range into CIDR blocks?

Open Range to CIDR blocks and enter the first and last address. The tool lists the fewest CIDR blocks that cover exactly that range. A range that is not aligned to a power of two needs several blocks, and the list shows each block's start, end and size.

Does this calculator handle IPv6?

No. It works with IPv4 addresses only, and it says so if you enter an IPv6 address. IPv6 prefixes use the same idea with 128 bits, but this tool does not cover them.

Why are leading zeros in an address rejected?

Some systems read a number with a leading zero as octal, so 010 can mean 8 rather than 10. To avoid a wrong answer the tool asks you to write 10. The message shows what the octal reading would be.

Updated Oct 15, 2026