ModernCalcs

Random IP Generator

Generate random IPv4 or IPv6 addresses — anywhere, within a specific CIDR range, or excluding private/reserved ranges.

Random IP Generator: Test Data That Doesn't Look Fake

Test data with placeholder IPs like 1.1.1.1 repeated a hundred times doesn't exercise your code the way real, varied traffic would. This tool generates random IPv4 or IPv6 addresses — either from anywhere in the address space, constrained to a specific CIDR range, or filtered to exclude private/reserved ranges that wouldn't appear in real public-facing traffic.

Formula
Random address = network bits (fixed by CIDR, if specified) + random host bits

Excluding private ranges filters out 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, loopback, link-local, and multicast.

Why 'Excluding Private Ranges' Matters for Realistic Test Data

If your test data simulates public internet traffic — visitor logs, API client IPs, geolocation test cases — addresses from RFC 1918 private ranges would never realistically show up. Filtering them out keeps generated test data plausible, which matters if that data feeds into anything that assumes 'this is a public-facing request.'

Generating Within a Specific CIDR Range

Sometimes you need addresses that look like they came from a specific network — testing an allowlist rule, simulating traffic from a known office subnet, or generating sample data for a specific customer's IP range. This mode fixes the network portion of the address (determined by the CIDR prefix) and randomizes only the remaining host bits, so every result is guaranteed to fall within that exact range.

IPv6's Much Larger Address Space

An IPv6 address has 128 bits versus IPv4's 32, generated here as 8 groups of 4 hex digits, each from 2 truly random bytes. This gives genuinely random addresses across the full IPv6 space — useful for testing that your application correctly handles IPv6 formatting, parsing, and storage, which is easy to overlook if all your test data has historically been IPv4.

Practical Examples

Generating Fake Access Log Data

Realistic public IPs for test logs.

  • 1.Mode: IPv4 (any)
  • 2.Exclude private/reserved: checked
  • 3.Generate 50 addresses for sample log entries

Simulating Traffic from a Known Subnet

Testing an allowlist rule.

  • 1.Mode: IPv4 (in CIDR)
  • 2.CIDR: 203.0.113.0/24
  • 3.Every generated address falls within that /24

Generation Modes

  • IPv4 (any): optionally excluding private/reserved ranges
  • IPv4 (in CIDR): constrained to a specific network
  • IPv6: fully random 128-bit addresses

Good Use Cases

  • Generating realistic sample data for logs or databases
  • Testing IP-based logic against varied, valid addresses
  • Simulating traffic from a specific subnet for allowlist testing
  • Populating demo/staging environments with plausible IP data

Frequently Asked Questions

Why exclude private/reserved ranges?

If you're generating sample public-facing IPs for test data (like fake visitor logs), addresses from ranges like 10.0.0.0/8 or 192.168.0.0/16 would look wrong — those ranges are reserved for private networks and never appear as real internet-routable addresses.

How does generating within a CIDR range work?

The tool takes your CIDR's network address, keeps the network bits fixed, and randomizes only the host bits — so every generated address falls genuinely within that specific range, useful for simulating traffic from a known subnet.

Are these real, currently-assigned IP addresses?

Not necessarily — they're randomly generated within the valid address space (or your specified range), not looked up against real-world allocation records. Some generated addresses may correspond to real assigned ranges, others to unassigned space; this tool doesn't check either way.

What's excluded by the 'private/reserved' filter specifically?

10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 (RFC 1918 private ranges), 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local), and 224.0.0.0/4 and above (multicast/reserved).

How random are the generated IPv6 addresses?

Each of the 8 groups is generated from 2 random bytes via crypto.getRandomValues(), giving a fully random 128-bit address across the entire IPv6 space — not restricted to any particular allocated range.

What are good use cases for this tool?

Generating realistic-looking test data (fake access logs, mock API responses), populating a database with sample records, or testing IP-based logic (geolocation lookups, allowlist/denylist code) against a variety of addresses.