IP Subnet Calculator (IPv4 & IPv6) - free ipcalc online
IP Subnet Calculator (IPv4 & IPv6)
Accepted: 10.1.2.3/20, 10.1.2.3 255.255.240.0, 10.1.2.3/0.0.15.255 (Cisco wildcard), 2001:db8::1/64. Without a prefix the address is treated as a single host (/32 or /128). Results update as you type.
Next steps: Plan subnets with VLSM Convert ranges to CIDR Wildcard / ACL helper
Route summarization & range to CIDR
Paste prefixes, single addresses or ranges (first - last), one per line or comma-separated. IPv4 and IPv6 can be mixed. The tool returns the smallest exact set of CIDR blocks that covers them – nothing more, nothing less.
What this subnet calculator does
Type an IPv4 or IPv6 address with a prefix length, a dotted netmask or a Cisco-style wildcard mask and the calculator shows the network address, broadcast address, first and last usable host, number of hosts, the mask in every notation, the binary view with network and host bits coloured, the address type (private, CGNAT, documentation, multicast…) and the reverse-DNS names. It can also split a block into smaller subnets, jump to the previous, next or parent prefix, and summarize a list of prefixes or an arbitrary address range into the minimal set of CIDR blocks. Everything runs locally in your browser – nothing you type is sent anywhere.
How it works
An IPv4 address is a 32-bit number and an IPv6 address a 128-bit number. A prefix length /p (CIDR notation, RFC 4632) says that the first p bits identify the network and the remaining bits identify a host inside it. All results are plain bitwise operations:
- Netmask =
pones followed by32 − pzeros (for /26:255.255.255.192). - Wildcard (host mask) = bitwise NOT of the netmask (for /26:
0.0.0.63). Cisco ACLs and OSPFnetworkstatements use this form. - Network address = address AND netmask.
- Broadcast address = network address OR wildcard (all host bits set to 1).
- Total addresses = 232 − p (IPv4) or 2128 − p (IPv6).
- Usable hosts (IPv4) = total − 2, because the all-zeros host (network) and all-ones host (directed broadcast) are not assigned to interfaces. Exceptions: a /31 has 2 usable addresses on point-to-point links (RFC 3021) and a /32 identifies exactly one host.
- IPv6 has no broadcast address (RFC 4291); the first address of a subnet is the Subnet-Router anycast address, and /127 is recommended for point-to-point links (RFC 6164). IPv6 output is written in the canonical compressed form of RFC 5952.
- Address type is looked up in the IANA special-purpose address registries (RFC 6890), e.g. private ranges from RFC 1918, shared CGNAT space from RFC 6598 and documentation ranges from RFC 5737 / RFC 3849.
- Reverse DNS names follow
in-addr.arpa(one label per octet) andip6.arpa(one label per hex nibble, RFC 3596). Prefixes that do not end on an octet boundary need classless delegation (RFC 2317). - Summarization sorts all ranges, merges overlapping or adjacent ones, and then cuts each merged range into the largest aligned power-of-two blocks, so the result covers exactly the input addresses.
A quick mental shortcut: the block size in the “interesting” octet is 256 minus the mask value in that octet. For 255.255.255.192 the block size is 64, so subnets start at .0, .64, .128 and .192.
Worked examples
Example 1: 192.168.10.77/26
/26 = 255.255.255.192, block size 64 in the last octet. 77 falls into the block 64–127, so the network is 192.168.10.64, the broadcast is 192.168.10.127, usable hosts are 192.168.10.65 – 192.168.10.126, i.e. 26 − 2 = 62 hosts. The address is private (RFC 1918).
Example 2: 10.1.2.3 with netmask 255.255.240.0
255.255.240.0 is /20; the block size in the third octet is 256 − 240 = 16. The third octet 2 lies in 0–15, so the network is 10.1.0.0/20, the broadcast is 10.1.15.255, hosts run from 10.1.0.1 to 10.1.15.254: 212 − 2 = 4094 hosts.
Example 3: wildcard mask 172.16.5.4 0.0.3.255
The wildcard 0.0.3.255 is the inverse of 255.255.252.0 = /22. The block size in the third octet is 4, and 5 lies in 4–7, so the network is 172.16.4.0/22, the broadcast is 172.16.7.255 and there are 1022 usable hosts.
Example 4: point-to-point link 198.51.100.6/31
A /31 holds two addresses, 198.51.100.6 and 198.51.100.7. Under RFC 3021 both are usable on a point-to-point link and there is no broadcast address, which saves half the addresses compared with a /30.
Example 5: IPv6 2001:db8:abcd:12::1/56
A /56 keeps the first 56 bits: the first three groups plus the high byte of the fourth group (0x00 of 0x0012). The network is 2001:db8:abcd::/56, the last address is 2001:db8:abcd:ff:ffff:ffff:ffff:ffff, and it contains 28 = 256 /64 subnets. 2001:db8::/32 is the documentation prefix (RFC 3849).
Example 6: summarization
192.168.0.0/24 + 192.168.1.0/24 summarize exactly to 192.168.0.0/23. The range 10.0.0.5 – 10.0.0.20 is not a power-of-two block, so it becomes 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/30 and 10.0.0.20/32.
IPv4 CIDR prefix reference
| Prefix | Netmask | Wildcard | 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 (RFC 3021) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (host) |
FAQ
What is the difference between a netmask and a wildcard mask?
A netmask has ones for the network bits (255.255.255.0 for /24); a wildcard mask is its bitwise inverse, with ones for the bits that may vary (0.0.0.255 for /24). Interfaces and routing tables use netmasks, while Cisco ACLs and OSPF network statements use wildcard masks. This calculator accepts both and also plain prefix lengths.
Why does a subnet have two fewer usable hosts than addresses?
In IPv4 the address with all host bits set to 0 identifies the network and the address with all host bits set to 1 is the directed broadcast, so neither is assigned to a host. The exceptions are /31, where both addresses are usable on point-to-point links (RFC 3021), and /32, which describes a single host route.
Are classes A, B and C still used?
No. Classful addressing was replaced by Classless Inter-Domain Routing in 1993; the current specification is RFC 4632. The class is shown only for reference, because it still appears in exams and in a few legacy defaults such as classful auto-summary in RIP and EIGRP.
Which IPv4 address ranges are private?
RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598), 169.254.0.0/16 is link-local (RFC 3927), and 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are reserved for documentation (RFC 5737).
Why is there no broadcast address for IPv6?
IPv6 does not define broadcast at all (RFC 4291); functions that used broadcast in IPv4 use multicast instead, for example the all-nodes group ff02::1. The calculator therefore shows the first and last address of an IPv6 prefix and the total number of addresses.
How does route summarization work?
Summarization combines contiguous prefixes into a shorter one when they form an aligned power-of-two block: two adjacent /24s whose first one starts on an even third octet become one /23. The summarizer here only produces exact summaries, so the output never covers addresses that were not in the input.
Comments
Post a Comment