What the random IP address generator does
It creates random internet protocol addresses. Choose IPv4, the familiar four numbers such as 135.68.115.145, or IPv6, the longer hexadecimal form such as 21ad:631c:53d2:d8e3:2eda:4eb0:9613:bd98. You can ask for public addresses only, private network addresses only, or any address at all, and generate up to 1,000 at once.
Developers use random addresses to fill test databases, check that forms and validators accept every valid format, try out log parsers and firewall rules, and write examples. Students use them to practise subnetting.
The addresses are made in your browser. The tool does not contact any of them and sends nothing over the network.
How to use it
- Under Version, press IPv4 or IPv6. Switching version makes a fresh batch straight away.
- Choose an Address range:
- Public only (skip private and reserved), the default.
- Private only (LAN, unique local) for home and office network addresses.
- Any address, which allows every possible value.
- Set How many. The default is 10 and the limit is 1,000.
- For IPv6, turn on Full IPv6 form if you need every group written out in full. The button is greyed out while IPv4 is selected.
- Choose how to Separate results with. New line is the default.
- Press Generate addresses, then Copy.
Your last ten batches stay under Recent results, each with a Copy button, until you leave the page or press Clear.
Examples
These came from real runs of the code behind this page.
| Settings | One run gave |
|---|---|
| IPv4, Public only | 135.68.115.145, 32.97.85.245, 120.174.184.237 |
| IPv4, Private only | 10.125.216.44, 10.219.46.158, 10.9.72.248 |
| IPv4, Any address | 170.62.138.27, 121.245.231.165, 143.171.94.124 |
| IPv6, Public only | 21ad:631c:53d2:d8e3:2eda:4eb0:9613:bd98 |
| IPv6, Public only | 2258:9a97:b7c7:f511:216c:969:b5ff:557d |
| IPv6, Private only | fd6e:3736:baea:555:1499:7806:3b7a:b276 |
| IPv6, Any address | ecbd:c4a8:4f41:64fe:3e7d:1b1b:27cc:5f17 |
| IPv6, Public only, Full IPv6 form | 2bd5:8531:03d4:eefc:9d19:9295:d31f:0a45 |
Notice the second IPv6 row. The group 969 is really 0969. Short form drops leading zeros, and when a run of whole zero groups appears, it is replaced with ::, so 2001:0db8:0000:0000:0000:0000:0000:0001 becomes 2001:db8::1.
How it works
An IPv4 address is a 32-bit number and an IPv6 address is a 128-bit number. The tool asks your browser’s secure random source, crypto.getRandomValues, for that many random bits and writes them in the usual notation.
IPv4, Public only. A random 32-bit value is drawn. If it falls inside a special-purpose block, it is thrown away and a new one is drawn. The skipped blocks are:
- 0.0.0.0/8 (“this network”)
- 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 (private networks)
- 100.64.0.0/10 (shared address space used by carriers)
- 127.0.0.0/8 (loopback) and 169.254.0.0/16 (link-local)
- 192.0.0.0/24, 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (protocol and documentation ranges)
- 192.88.99.0/24 and 198.18.0.0/15 (old relay and benchmarking ranges)
- 224.0.0.0/4 (multicast) and 240.0.0.0/4 (reserved, including 255.255.255.255)
Throwing away and redrawing keeps every remaining public address equally likely.
IPv4, Private only. The tool picks one address from the three private blocks combined. Each block gets a share in proportion to its size, so every private address has the same chance.
IPv6, Public only. Results stay inside global unicast space, 2000::/3, which means the first group starts with 2 or 3. The tool skips 2001::/23 (protocol assignments), 2001:db8::/32 and 3fff::/20 (documentation) and 2002::/16 (6to4).
IPv6, Private only. Results are unique local addresses in fd00::/8, the half of fc00::/7 meant for locally assigned networks.
Tips and limits
- Test data only. Public addresses made here may belong to real networks. Do not use them to send traffic.
- For documentation, use the ranges reserved for examples. Use 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 or 2001:db8::/32 in guides and screenshots.
- Duplicates. Addresses are drawn independently. With billions of possible values a repeat in a small batch is very unlikely, but the tool does not block it.
- Assigned or not. Public only means “not in a special block”. It does not check whether an address has actually been handed out to anyone.
- Binary practice. To see an address as bits, convert each number with the binary code translator. For example, 10 is 00001010.
Other ways to make random IP addresses
Python. ipaddress.IPv4Address(random.getrandbits(32)) makes any IPv4 address, and ipaddress.IPv6Address(random.getrandbits(128)) any IPv6 address. Check .is_global or .is_private on the result and draw again if it does not fit.
Excel or Google Sheets. =RANDBETWEEN(1,223)&"."&RANDBETWEEN(0,255)&"."&RANDBETWEEN(0,255)&"."&RANDBETWEEN(1,254) builds a rough IPv4 address. It does not skip private or reserved blocks.
Faker libraries. Test data packages for many languages include IP address helpers.
Related tools
For unique IDs to go with your test records, use the UUID generator. For random port numbers or other values, use the random number generator with a range such as 1024 to 65535.