Skip to content
Case Converter Online
en

Random IP Address Generator

Generate random IPv4 or IPv6 addresses for test data, examples and network exercises. Keep them public, keep them private, or allow any address.

Version
Options

Result

Recent results

  1. Your last 10 results appear here. They are kept only until you leave the page.

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

  1. Under Version, press IPv4 or IPv6. Switching version makes a fresh batch straight away.
  2. 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.
  3. Set How many. The default is 10 and the limit is 1,000.
  4. 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.
  5. Choose how to Separate results with. New line is the default.
  6. 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.

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.

Random IP Generator: questions and answers

Which addresses does Public only skip?

For IPv4 it skips the special blocks: 0.0.0.0/8, private networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), shared address space 100.64.0.0/10, loopback 127.0.0.0/8, link-local 169.254.0.0/16, the documentation and benchmarking ranges, multicast 224.0.0.0/4 and the reserved 240.0.0.0/4 block. For IPv6 it stays inside global unicast 2000::/3 and skips 2001::/23, 2001:db8::/32, 2002::/16 and 3fff::/20.

Why do most private IPv4 results start with 10?

Each private address has the same chance, and the 10.0.0.0/8 block is by far the biggest. It holds 16,777,216 addresses, against 1,048,576 in 172.16.0.0/12 and 65,536 in 192.168.0.0/16. So most picks land in 10.x.x.x.

Are these real addresses that belong to someone?

A public address made here may well be in use by a real network. Use generated addresses as test data only, never to scan or contact hosts. For examples in documents, the reserved documentation ranges such as 192.0.2.0/24 and 2001:db8::/32 are the safe choice.

What does Full IPv6 form do?

IPv6 addresses are normally shortened by dropping leading zeros and replacing one run of zero groups with ::. Full IPv6 form shows all eight groups with four digits each, for example 2bd5:8531:03d4:eefc:9d19:9295:d31f:0a45.