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

Page: https://hirantha.me/tools/ip-subnet-calculator
Part of: Hirantha Sandaruwan Lakshan free tools (https://hirantha.me/tools)
Updated: 2026-10-15

Work out network, broadcast, netmask, wildcard, host range and host count from a CIDR or mask. Split a network into subnets or turn an IP range into CIDR blocks.

This is a free tool that runs in the browser: open the page to use it. File tools process files on the visitor's own device; files are never uploaded or stored. No account, sign-up, payment or watermark.

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. 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.

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.

Every IPv4 prefix length with its netmask, wildcard mask and size:
| Prefix | Netmask | Wildcard mask | Total addresses | Usable hosts |
| --- | --- | --- | --- | --- |
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /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 |

Q: What is the difference between a netmask and a wildcard mask?
A: 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.

Q: How many usable hosts are in a /24, a /26 and a /30?
A: 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.

Q: Why do you subtract 2 from the number of addresses?
A: 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.

Q: What are a /31 and a /32?
A: 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.

Q: Which IPv4 ranges are private?
A: 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).

Q: What does 169.254.x.x mean?
A: 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.

Q: What is the 100.64.0.0/10 range?
A: 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.

Q: How do I turn an IP range into CIDR blocks?
A: 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.

Q: Does this calculator handle IPv6?
A: 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.

Q: Why are leading zeros in an address rejected?
A: 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.

Sources: RFC 4632: Classless Inter-domain Routing (CIDR) (https://www.rfc-editor.org/rfc/rfc4632); RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links (https://www.rfc-editor.org/rfc/rfc3021); RFC 1918: Address Allocation for Private Internets (https://www.rfc-editor.org/rfc/rfc1918); RFC 3927: Dynamic Configuration of IPv4 Link-Local Addresses (https://www.rfc-editor.org/rfc/rfc3927); RFC 6598: IANA-Reserved IPv4 Prefix for Shared Address Space (https://www.rfc-editor.org/rfc/rfc6598); RFC 5771: IANA Guidelines for IPv4 Multicast Address Assignments (https://www.rfc-editor.org/rfc/rfc5771); RFC 791: Internet Protocol (address classes) (https://www.rfc-editor.org/rfc/rfc791); RFC 1112: Host Extensions for IP Multicasting (class D and E) (https://www.rfc-editor.org/rfc/rfc1112); IANA IPv4 Special-Purpose Address Registry (https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml)

Related tools:

- [URL parser](https://hirantha.me/tools/url-parser.md): Split any URL into protocol, host, port, path, query parameters and fragment. Decodes percent-encoding, flags tracking parameters and rebuilds the URL.
- [Cron expression explainer](https://hirantha.me/tools/cron-expression-explainer.md): Paste a five-field cron expression to read it in plain English, see a field-by-field breakdown and list the next 10 run times in any time zone.
- [Number base converter](https://hirantha.me/tools/number-base-converter.md): Convert whole numbers between binary, octal, decimal, hex and any base from 2 to 36 with exact BigInt maths, negatives, two's complement and step-by-step working.
- [Chmod calculator](https://hirantha.me/tools/chmod-calculator.md): Tick read, write and execute boxes to get the chmod number and rwxr-xr-x string, read u+x style changes, work out a umask, and copy safe chmod and find commands.
