Choose the right kind of random IP
| Type | IPv4 | IPv6 | Use it for |
|---|---|---|---|
| Public | Everything outside the special-purpose blocks | Global unicast 2000::/3 without the special-purpose blocks | Testing IP parsing, geolocation lookups, rate limiting and log analysis |
| Private | 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 (RFC 1918) | fd00::/8 unique local (RFC 4193) | LAN and VPC configurations, Docker and Kubernetes networks |
| Documentation | 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 (RFC 5737) | 2001:db8::/32 (RFC 3849) and 3fff::/20 (RFC 9637) | Docs, tutorials, screenshots, test fixtures |
| Carrier-grade NAT | 100.64.0.0/10 (RFC 6598) | — | Testing ISP and mobile-network scenarios |
| Loopback | 127.0.0.0/8 | ::1 | Local services and allow-lists |
| Link-local | 169.254.0.0/16 | fe80::/10 | Auto-configuration when no DHCP server answers |
For IPv4 the public option skips every special-purpose block in the IANA registry: “this network” (0.0.0.0/8), private, CGNAT, loopback, link-local, IETF protocol assignments (192.0.0.0/24), documentation, the old 6to4 relay (192.88.99.0/24), benchmarking (198.18.0.0/15), multicast (224.0.0.0/4), reserved (240.0.0.0/4) and broadcast. For IPv6 it stays in global unicast 2000::/3 and leaves out the IETF protocol assignments 2001::/23 (Teredo among them), both documentation ranges 2001:db8::/32 and 3fff::/20, and 2002::/16 (6to4). Note that most of 2000::/3 is not yet allocated to anyone, so random IPv6 addresses are realistic in format rather than in distribution.
Documentation addresses: the safe default
If you need IPs for a README, an API example, a blog post or a unit test, use the documentation ranges. They exist for that purpose and are never routed, so an example can never point at somebody’s real server. For IPv6 there are now two: the classic 2001:db8::/32 and, since 2024, the much larger 3fff::/20 (RFC 9637), which leaves room to document realistic multi-site networks. Random public addresses, on the other hand, may belong to real machines: treat them as data for parsers and analytics, never as something to connect to or scan.
Generate addresses inside a subnet
Choose Inside a subnet and enter a block such as 10.20.0.0/16, 192.168.1.0/24 or, for IPv6, 2001:db8:abcd::/48 to get random addresses from that network — to fill an inventory, test firewall rules or seed a DHCP lease table. A /24 holds 256 addresses, 254 of them usable hosts, and a /16 65,536; ask for more than the subnet holds and you get each one once. Usable hosts only (on by default) leaves out the network and broadcast addresses of IPv4 subnets up to /30. Tick Sort for numeric order.
Use cases
- Rate limiting and abuse rules: replay requests from hundreds of distinct client IPs and check that limits apply per address.
- Geo-IP and analytics fixtures: feed public addresses into your lookup code and dashboards; use documentation addresses where the output will be published.
- Firewall and allow-list tests: generate addresses inside and outside a CIDR block to confirm which side of the rule they fall on.
- Log anonymisation: replace real client IPs in shared logs with documentation addresses that keep the format.
How the generator works
Every address comes from your browser’s cryptographic random number generator (crypto.getRandomValues). For public IPv4 addresses the generator draws a uniformly random 32-bit number and redraws whenever it falls into a special-purpose block, so all public addresses are equally likely. Subnet and IPv6 addresses take the network prefix and fill the host bits at random. Duplicates are removed, and nothing is sent to a server. To do the same in your own code:
# Python: one random public IPv4 address
import ipaddress, secrets
while not (ip := ipaddress.IPv4Address(secrets.randbits(32))).is_global:
pass
# Python: a random host in a subnet
net = ipaddress.ip_network("10.20.0.0/16")
host = net[1 + secrets.randbelow(net.num_addresses - 2)]
// JavaScript (browser or Node 19+): a random IPv4 address
const ip = Array.from(crypto.getRandomValues(new Uint8Array(4))).join(".");
Frequently asked questions
Are random IP addresses real?
Random public addresses are valid and may be assigned to real devices. That is fine for testing parsers or analytics, but don’t connect to them, scan them or publish them as examples. Documentation, private and loopback addresses never point at anyone else’s host.
Can a random IP address hide or change my IP?
No. Generating addresses doesn’t change the IP your connection uses; websites still see your real address. Hiding it takes a VPN, a proxy or Tor. Sending packets with a forged source address doesn’t work for normal web traffic either, because the replies go to the forged address.
Which IP address should I use in documentation?
Use 192.0.2.0/24, 198.51.100.0/24 or 203.0.113.0/24 for IPv4 and 2001:db8::/32 or 3fff::/20 for IPv6. Avoid invented public addresses such as 1.2.3.4, which belong to real networks.
What are IP address classes A to E?
The pre-1993 split by first octet: A (0–127), B (128–191), C (192–223), D (224–239, multicast) and E (240–255, reserved). CIDR replaced classes long ago, so the class says nothing about the real network size, but the checker shows it because exams and older documentation still use it.
Is this an IP address generator for assigning IPs to devices?
No. Devices get their addresses from DHCP or static configuration on your network. This tool generates addresses as data — for tests, documentation and configuration examples — and the subnet option is the closest match for planning: it shows random addresses that fit a block.
Can I add ports or change the output format?
Yes. Tick Add a random port for address:port pairs (IPv6 as [address]:port), and choose one per line, comma- or space-separated, a JSON array or a quoted list for SQL.