Subnet Calculator
Type an IPv4 or IPv6 address, alone or with a prefix length or subnet mask. The calculator detects the address family on its own and shows the network, host range, masks, and address type. Without a length, IPv4 falls back to the classful default and IPv6 to a /64. After the calculation you can migrate the network to a longer prefix and see every resulting subnet, and an IPv4 network also gets its IPv6 transition forms for migration planning. The inclusive IP range counter below counts every address from a first address through a last address. The addresses you enter stay in your browser and are not sent anywhere.
Inclusive IP Range Counter
Enter two IPv4 addresses or two IPv6 addresses. The total includes both endpoints and every numeric address between them. Both addresses must use the same IP version.
IPv4 Prefix and Subnet Mask Chart
Use this IPv4-only reference to compare CIDR prefix lengths, dotted-decimal masks, address counts, and usable host counts. The calculator highlights the active IPv4 prefix.
Classful Defaults
When an IPv4 address arrives without a prefix length or mask, the calculator applies the historical classful default based on the first octet.
| Class | First octet | Default length | Default mask |
|---|---|---|---|
| A | 1 to 126 | /8 | 255.0.0.0 |
| B | 128 to 191 | /16 | 255.255.0.0 |
| C | 192 to 223 | /24 | 255.255.255.0 |
| D (multicast) | 224 to 239 | /32 shown | none defined |
| E (reserved) | 240 to 255 | /32 shown | none defined |
The 127.0.0.0/8 block is loopback and follows the class A default. Classful addressing was replaced by CIDR (RFC 4632), so the defaults matter mostly for legacy commands and exam questions. IPv6 has no classes; without a length the calculator assumes /64, the standard size of a single IPv6 subnet.
Transition Mechanisms
For an IPv4 input, the calculator derives the address forms used by common IPv6 migration techniques.
| Form | Prefix | Purpose | Reference |
|---|---|---|---|
| IPv4-mapped | ::ffff:0:0/96 | Represents an IPv4 address inside an IPv6 socket or API | RFC 4291 |
| 6to4 | 2002::/16 | Derives a routable /48 site prefix from a public IPv4 address | RFC 3056 |
| NAT64 | 64:ff9b::/96 | Well-known translator prefix that embeds the IPv4 destination | RFC 6052 |
The reverse also works. Paste an IPv4-mapped, NAT64, or 6to4 IPv6 address and the calculator extracts the embedded IPv4 address.