Generate Random IP Address
Generate up to 1,000 random IPv4 or IPv6 addresses: public addresses that avoid every special-purpose range, private RFC 1918 or IPv6 unique local addresses, documentation addresses that are safe to publish, or hosts inside a subnet you choose. Each address is labelled with its type.
Ranges from the IANA special-purpose address registries
The IPv4 Ranges a "Public" Address Must Avoid
About 14% of the 4.3 billion IPv4 addresses are set aside for special purposes and never appear on the public internet. The public option skips all of them; the Type column names the range for any address that falls inside one.
| Block | Purpose | Defined in |
|---|---|---|
| 0.0.0.0/8 | "This network"; 0.0.0.0 means "any address" to software | RFC 791 |
| 10.0.0.0/8 | Private networks | RFC 1918 |
| 100.64.0.0/10 | Carrier-grade NAT between an ISP and its customers | RFC 6598 |
| 127.0.0.0/8 | Loopback (this device) | RFC 1122 |
| 169.254.0.0/16 | Link-local; what you get when DHCP fails | RFC 3927 |
| 172.16.0.0/12 | Private networks (172.16 to 172.31) | RFC 1918 |
| 192.0.0.0/24 | IETF protocol assignments | RFC 6890 |
| 192.0.2.0/24 | Documentation (TEST-NET-1) | RFC 5737 |
| 192.168.0.0/16 | Private networks | RFC 1918 |
| 198.18.0.0/15 | Network benchmarking | RFC 2544 |
| 198.51.100.0/24 | Documentation (TEST-NET-2) | RFC 5737 |
| 203.0.113.0/24 | Documentation (TEST-NET-3) | RFC 5737 |
| 224.0.0.0/4 | Multicast | RFC 5771 |
| 240.0.0.0/4 | Reserved, including 255.255.255.255 broadcast | RFC 1112 |
"Public" here means outside those ranges, not that the address is in use. Most public IPv4 addresses are allocated to someone, so a random one can belong to a real home, company or server.
Worked Example: A Random Host in 10.20.0.0/22
A test lab uses the subnet 10.20.0.0/22 and needs 50 fake device addresses for a firewall rule test. Which addresses can be used?
Step 1: Host bits
Step 2: First and last address
Step 3: Usable hosts
Choose "Inside my subnet", enter 10.20.0.0/22 and ask for 50 with No repeats. The panel shows the same network, mask and range, and every address is a valid host. Note that 10.20.1.0 and 10.20.2.255 are ordinary hosts here: only the very first and last addresses of the whole /22 are reserved. A /31 keeps both of its addresses for point-to-point links (RFC 3021), and a /32 is a single host.
The Three Private IPv4 Blocks
| Block | Addresses | Where you usually see it |
|---|---|---|
| 10.0.0.0/8 | 16,777,216 | Company networks, cloud VPCs |
| 172.16.0.0/12 | 1,048,576 | Docker's default bridge (172.17.0.0/16), some corporate networks |
| 192.168.0.0/16 | 65,536 | Home routers: 192.168.0.x and 192.168.1.x |
The 10.x block is 256 times bigger than 192.168.x, so drawing uniformly from all private addresses would almost never produce a familiar 192.168 address. The Mix setting picks the block first, each with a one-in-three chance, then an address inside it, which gives realistic-looking test data. Pick a single block for something more specific.
Private addresses are reused by millions of networks and can't be reached from the internet directly; traffic leaves through NAT. Carrier-grade NAT space, 100.64.0.0/10, looks private but belongs to your ISP; don't use it for your own LAN.
What the Start of an IPv6 Address Tells You
Truly random 128-bit values are mostly in space that hasn't been allocated for anything. Real internet addresses come from 2000::/3, so they start with 2 or 3. That's why the global option keeps the first three bits fixed.
| Starts with | Prefix | Type |
|---|---|---|
| 2 or 3 | 2000::/3 | Global unicast: real internet addresses |
| 2001:db8: or 3fff: | 2001:db8::/32, 3fff::/20 | Documentation; never routed |
| fd | fc00::/7 (fd00::/8 in use) | Unique local: the IPv6 counterpart of private addresses |
| fe80: | fe80::/10 | Link-local: every interface has one |
| ff | ff00::/8 | Multicast |
| ::1 | ::1/128 | Loopback |
| ::ffff: | ::ffff:0:0/96 | An IPv4 address inside IPv6, e.g. ::ffff:192.0.2.1 |
3fff::/20 was added as a second documentation prefix in 2024 (RFC 9637) because 2001:db8::/32 is too small to show realistic large networks.
Writing IPv6 the Standard Way
The same IPv6 address can be written many ways, which breaks text comparisons in logs and spreadsheets. RFC 5952 fixes one canonical form, used by this page when Compress is ticked:
- Lowercase letters, and no leading zeros in a group:
0db8becomesdb8. - Replace the longest run of two or more all-zero groups with
::. If two runs tie, shorten the first. - Never use
::for a single zero group.
| Full form | Canonical form |
|---|---|
| 2001:0db8:0000:0000:0000:ff00:0042:8329 | 2001:db8::ff00:42:8329 |
| 2001:0db8:0000:0000:0001:0000:0000:0001 | 2001:db8::1:0:0:1 |
| 2001:0db8:0000:0001:0001:0001:0001:0001 | 2001:db8:0:1:1:1:1:1 |
| 0000:0000:0000:0000:0000:0000:0000:0001 | ::1 |
Why Unique Local Addresses Are Random
IPv4 private networks all reuse the same few blocks, so when two companies merge, their 192.168.1.x networks collide and need renumbering. IPv6 unique local addresses avoid that: each site chooses a random 40-bit Global ID once, giving it its own fdxx:xxxx:xxxx::/48 with 65,536 subnets.
With 2⁴⁰ possible IDs, RFC 4193 puts the chance of a clash when 10 such networks are joined at about 4.5 × 10⁻¹¹. With One site ticked, every address in the list shares one random /48, as it would on a real network; untick it to give each address its own site.
Random Addresses in Python
import ipaddress, random
# a usable host in a subnet
net = ipaddress.ip_network('10.20.0.0/22')
host = net[random.randrange(1, net.num_addresses - 1)] # 10.20.x.y
# a random IPv4 address, then check what kind it is
addr = ipaddress.IPv4Address(random.getrandbits(32))
addr.is_private, addr.is_global, addr.is_multicast
# canonical IPv6 text
str(ipaddress.ip_address('2001:0db8:0000:0000:0000:ff00:0042:8329'))
# '2001:db8::ff00:42:8329'Python's ipaddress module knows the same special-purpose registries, so is_global is a good cross-check for addresses from this page. Its string output already follows RFC 5952.
Frequently asked questions
Is a random public IP address someone’s real address?
Quite possibly. Most public IPv4 space is allocated, so a random public address may belong to a real network. Use the documentation option for anything you publish, and don’t scan or probe random addresses.
Which IP addresses are safe to use in examples?
For IPv4, 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (RFC 5737). For IPv6, 2001:db8::/32 and 3fff::/20. They are never routed on the internet.
Can I generate an IP address for a particular country?
No. Addresses are allocated to networks by regional registries and change hands over time, so a range doesn’t reliably mean a country. Use documentation addresses for examples instead.
Why do I lose two addresses in an IPv4 subnet?
The first is the network address and the last is the broadcast address. A /24 has 256 addresses and 254 usable hosts. /31 point-to-point links and /32 single hosts are exceptions.
Sources
- IANA IPv4 Special-Purpose Address Registry: every reserved IPv4 block the public option avoids.
- IANA IPv6 Special-Purpose Address Registry: reserved IPv6 blocks.
- RFC 1918: Address Allocation for Private Internets: the three private IPv4 blocks.
- RFC 6598: Shared Address Space (100.64.0.0/10): carrier-grade NAT.
- RFC 5737: IPv4 Address Blocks Reserved for Documentation: TEST-NET-1, 2 and 3.
- RFC 3849: IPv6 Address Prefix Reserved for Documentation: 2001:db8::/32.
- RFC 9637: Expanding the IPv6 Documentation Space: 3fff::/20.
- RFC 4193: Unique Local IPv6 Unicast Addresses: the random 40-bit Global ID and collision odds.
- RFC 5952: A Recommendation for IPv6 Address Text Representation: the canonical compressed form.
- RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links: why /31 keeps both addresses.
- Python documentation: ipaddress: is_private, is_global and network indexing.
Related Tools
Create GUIDs for Microsoft and .NET fields.
Generate binary numbers with a chosen bit length.
Create a random pixel image and save it as a PNG.
Generate bytes in hex, Base64, or decimal format.
Pick a date between your chosen start and end dates.
Generate decimals with a chosen range and precision.