IPv4 & IPv6 · CIDR · Country Ranges · Bulk Up to 500

Random IP Address
Generator

Generate IPv4, IPv6, private, public, class-based, CIDR subnet, country-range and IP:PORT addresses. Bulk export as TXT, CSV or JSON. No signup, and every address is produced in your own browser.

Quick Answer: What Is a Random IP Generator?

A random IP address generator produces correctly formatted IPv4 or IPv6 addresses for testing, seeding databases and teaching, without touching real user records. Pick one of five modes — Type, CIDR Block, Custom Range, Country or Validator — choose up to 500 addresses, and export as TXT, CSV or JSON. Nothing is sent to a server: the generation runs entirely in your browser.

Generation Mode

IP Type

10

Configure options and press Generate

Up to 500 addresses · IPv4 & IPv6 · CIDR · Country · TXT / CSV / JSON

Last verified 8 August 2026. Public IPv4 output is filtered against the full IANA IPv4 Special-Purpose Address Registry, and the exclusion was confirmed across 500,000 generated addresses. Nothing you type or generate is transmitted anywhere.

Copied
Robert Harrison, OSINT and Network Utility Expert, explaining the random IP address generator at TrustMyIP.com
Written & Verified By

Robert Harrison

OSINT & Network Utility Expert

A team I worked with in March seeded forty thousand staging rows with addresses from a generator that only filtered the obvious private blocks. Two of those rows landed in 198.18.0.0/15, which is reserved for device benchmarking, and their new firewall silently dropped every request from that range. Three days of debugging for a filter that was one line short. That is why the public generator here is checked against the entire IANA special-purpose registry rather than a handful of first-octet rules.

One honest limit worth stating. These addresses are arbitrary, not unallocated. Most of the public IPv4 space is delegated to somebody, so an address this tool prints may well belong to a real network. It is safe for test data because it carries no traffic and identifies no person, but do not treat it as proof that an address is free, and never point real traffic at one.

View all articles by Robert Harrison

What Is a Random IP Address Generator?

A random IP address generator produces correctly formatted IPv4 or IPv6 addresses on demand. You use them wherever code needs to handle addresses but you do not want real user data anywhere near a test environment.

The distinction that matters, and that most tools gloss over: these addresses are arbitrary, not unassigned. Public IPv4 space ran out years ago, so almost any routable address you generate belongs to some network. What makes it safe as test data is that it identifies no person and carries no traffic — not that it is somehow unclaimed.

Curious what a real address actually reveals? Put one through our IP geolocation and ISP lookup to see the data a website collects from a live connection. For the underlying concepts, our plain-English guide to IP addresses covers the fundamentals.

Use it for: test fixtures, staging databases, lab topologies, firewall rule exercises and teaching. Do not use it for: misrepresenting where you are, or as evidence that an address is free to claim. To see your own address, visit our IP checker.

What This Generator Covers

Most generators give you one format and one button. This one has five modes:

  • By Type — public IPv4, private IPv4, Class A/B/C, IPv6 compressed, IPv6 full, loopback, link-local
  • By CIDR Block — enter any subnet such as 192.168.1.0/24 and generate usable hosts inside it
  • Custom Range — set a start and end address, validated as you type
  • By Country — an IP address generator by country, drawing from blocks delegated to networks in ten countries
  • IP Validator — analyze any address: class, type, integer, binary, reverse DNS, routability

Why the public mode is stricter than it looks: alongside the obvious private blocks it also excludes 198.18.0.0/15 (benchmarking), 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 (documentation), 192.88.99.0/24 (retired 6to4 relay), 192.31.196.0/24 and 192.175.48.0/24 (AS112), 192.52.193.0/24 (AMT) and 100.64.0.0/10 (carrier-grade NAT). Those are the ones that slip through most generators and cause confusing failures later.

IPv4 vs IPv6: Which Format Should You Generate?

This tool generates both. Picking the right one depends on what your code has to survive. For the full technical comparison, see our IPv4 and IPv6 header breakdown.

IPv4 — still the default almost everywhere

IPv4 is 32 bits, written as four decimal octets separated by dots, each 0 to 255. Example: 203.45.78.129. That gives about 4.3 billion possible addresses, which the internet outgrew long ago.

IPv6 — the format your parser will eventually meet

IPv6 is 128 bits, written as eight groups of four hexadecimal digits separated by colons. Example: 2001:0db8:85a3::8a2e:0370:7334. Leading zeros are dropped and the longest run of zero groups collapses to ::, which is exactly where naive validators fall over.

IPv4 at a glance

  • 32-bit, four octets, dot notation
  • About 4.3 billion addresses
  • Effectively exhausted
  • Example: 192.168.1.100

IPv6 at a glance

  • 128-bit, eight groups, colon-hex
  • 340 undecillion addresses
  • Stateless auto-configuration
  • Example: 2001:db8::1

Reach for the random IPv4 modes when your code parses classic dot notation, and generate random IPv6 addresses specifically when you want to break your own validation code. Compressed forms, the all-zero ::, and IPv4-mapped addresses such as ::ffff:192.168.1.1 are where most hand-written regexes fail. To expand a compressed address into its full form, use our IPv6 expansion tool.

IP Address Classes A, B and C: Why They Still Appear

Classful addressing was replaced by CIDR in 1993, yet the vocabulary survives in interview questions, certification exams and a great deal of older documentation. Generating class-specific addresses is useful when your test data has to mirror those conventions. Our guide to IP address classes covers the history.

ClassFirst OctetDefault MaskMax HostsTypical Use
Class A1 – 126/8 (255.0.0.0)16,777,214Large carriers, early allocations
Class B128 – 191/16 (255.255.0.0)65,534Universities, mid-size networks
Class C192 – 223/24 (255.255.255.0)254Home and small office networks
Class D224 – 239n/an/aMulticast groups
Class E240 – 255n/an/aReserved, largely unusable

Notice that 127 is missing from Class A. The whole of 127.0.0.0/8 is loopback, which is why the generator treats it as its own type rather than folding it into Class A. For precise subnet work, switch to CIDR mode and pair it with our CIDR calculator and subnet builder.

About 127.x.x.x: every address in that block loops back to the local machine, not just 127.0.0.1. Packets never reach a network interface. Loopback mode generates across the full block, which is useful for testing that your code handles 127.42.9.1 the same way it handles localhost — a surprising number of applications do not.

Private IP Ranges: What RFC 1918 Means for Test Data

Private addresses, defined in RFC 1918, are reserved for internal networks and never routed on the public internet. Your router uses NAT so every device behind it shares one public address. Read our guide to reading address formats for how these ranges appear in practice.

RangeCIDRAddressesTypical Use
10.0.0.0 – 10.255.255.25510.0.0.0/816,777,216Large corporate networks, VPNs
172.16.0.0 – 172.31.255.255172.16.0.0/121,048,576Mid-size business networks
192.168.0.0 – 192.168.255.255192.168.0.0/1665,536Home routers, small offices

Selecting IPv4 Private draws from all three blocks, so a single batch of random private IP addresses spans 10.x, 172.16–31.x and 192.168.x the way a real mixed environment would. That is what you want when you are:

  • Simulating internal network logs
  • Populating VPN configuration fixtures
  • Testing firewall rules that treat public and private traffic differently
  • Building X-Forwarded-For scenarios
  • Demonstrating NAT in a classroom

Worth doing: mix private and public addresses in the same fixture. A large share of production bugs in proxy handling only appear when an application receives a private address in a header it expected to be public. Generate one batch of each, merge them, and run your parser against the combined set.

What Do You Use a Random IP List For? Seven Real Cases

Developers, QA engineers, security researchers and instructors reach for a random IP address generator constantly, usually because they need a bulk IP list in a hurry and typing one by hand is both slow and biased. These are the situations where it saves real time.

1. API and application testing

Anything that touches addresses — geolocation lookups, fraud scoring, access control lists — needs varied input. A test IP address generator removes the temptation to reuse 8.8.8.8 in every case. Generate 100 random IP addresses, or 500, and paste them straight into your fixtures. Every batch is unique by default, so each row exercises a different path through your code.

2. Database seeding

Staging data should look real without being real, which is the whole point of a random IP address for testing. A dummy IP address works as a placeholder for columns like last_login_ip or signup_ip without ever touching a production record. Use the CSV export and load it straight into MySQL, PostgreSQL or MongoDB.

3. Lab topologies

Building a GNS3, Packet Tracer or EVE-NG lab means allocating a lot of addresses quickly. Use CIDR mode so everything stays inside the subnet you designed.

4. Security testing

Testing WAF rules or input sanitization needs address sets that hit edge cases. Because this generator excludes the full reserved registry, the public set reflects what genuinely routable traffic looks like.

5. Load testing

Injecting varied source addresses into X-Forwarded-For during a JMeter or Locust run exercises per-IP rate limiting and abuse detection the way real traffic would.

6. Teaching

Subnetting exercises and binary conversion practice need fresh numbers every session. Pair this with our IP to binary converter for a complete lesson.

7. Explaining privacy

Demonstrating what an address discloses is easier with a generated one than with a volunteer's real address. To see what a live connection gives away, run our WHOIS ownership lookup on any address, and read how to hide your IP address for free for the ways to change it.

Is a Fake IP Address Generator the Same Thing?

People search for a fake IP address generator and an IP address randomizer far more often than they search for the technically correct name, and the two phrases mean two very different things depending on who is typing them.

If you want a string that looks like an address so your test suite has something to chew on, then yes, that is exactly this tool. If you want to appear to be somewhere else while browsing, then no, and no generator can do that. The distinction is worth being blunt about because a lot of pages blur it.

What you wantDoes a generator do it?What actually does
Test data that parses as an addressYesThis tool
Fill a staging databaseYesThis tool, CSV export
Appear to browse from another countryNoA VPN or proxy that carries your packets
Hide your address from a websiteNoA VPN, Tor, or a proxy
Bypass a rate limit or a banNoNothing you should be doing

The reason is simple. Your address is not a setting your browser sends along with a request. It is the return address on every packet, chosen by the network you are connected to, and a website reads it from the connection itself. Writing a different number into a text box changes nothing about where the replies go.

If you are using a VPN and want to confirm it is actually doing its job, our WebRTC leak test shows whether your real address is escaping through the browser, and the IP fraud score checker shows how a site is likely to rate the address you are currently presenting.

CIDR Block Mode: Generate Inside Any Subnet

CIDR notation describes a range precisely. Enter a block and the tool works out its usable host range, then generates only inside it.

How the notation works

A block looks like 192.168.1.0/24. The number after the slash is the prefix length: how many leading bits are fixed for the network. The remaining bits form the host portion.

CIDRSubnet MaskUsable HostsExample Range
/8255.0.0.016,777,21410.0.0.1 – 10.255.255.254
/12255.240.0.01,048,574172.16.0.1 – 172.31.255.254
/16255.255.0.065,534192.168.0.1 – 192.168.255.254
/24255.255.255.0254192.168.1.1 – 192.168.1.254
/28255.255.255.2401410.0.0.1 – 10.0.0.14
/31255.255.255.2542Point-to-point link, RFC 3021
/32255.255.255.2551A single host

The host count appears live as you type, and the network and broadcast addresses are excluded automatically — except at /31 and /32, where RFC 3021 makes both addresses usable on a point-to-point link. Ask for more addresses than the block contains with No Duplicates on and the tool tells you how many were actually available instead of quietly returning a short list.

Practical use: match the block to the subnet of the VPC you are documenting. The addresses then read as plausible node identifiers in your architecture diagrams rather than obviously invented ones.

IP Validator Mode: Analyze Any IPv4 or IPv6 Address

The validator does more than a format check. It parses the address properly and reports what it actually is — including rejecting the malformed input that trips up most hand-written checks.

What it reports for IPv4

  • Class — A, B, C, D or E from the first octet
  • Type — public, private, loopback, link-local, multicast or broadcast
  • Integer value — the 32-bit representation
  • Binary — all four octets, useful for subnetting practice
  • Reverse DNS — the in-addr.arpa PTR name
  • Routable — whether the address can appear on the public internet

For IPv6 it handles compressed notation, the all-zero ::, and IPv4-mapped forms like ::ffff:192.168.1.1. It also rejects the near-misses: 1::2::3 has two compressions, ::: is never valid, and 2001:db8:::1 is malformed. A regex that accepts those will happily let bad data into your database.

Validating in your own code

# PHP - both families
if (filter_var($ip, FILTER_VALIDATE_IP)) { /* valid */ }

# PHP - IPv4 only, and reject private and reserved space
if (filter_var($ip, FILTER_VALIDATE_IP,
        FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
    /* publicly routable IPv4 */
}

# Python - with property detection
import ipaddress
try:
    obj = ipaddress.ip_address("192.168.1.1")
    print(obj.version, obj.is_private, obj.is_loopback, obj.is_global)
except ValueError:
    print("Invalid IP")

Validate on the server. Client-side checks are a convenience, not a control — anyone can bypass them. Use filter_var() in PHP or the ipaddress module in Python before an address reaches your database.

How This Random IPv4 and IPv6 Generator Works Internally

Every address is produced in your browser. No request is made, nothing is logged, and there is no rate limit.

Public IPv4

A random 32-bit integer is drawn and rejected if it falls inside any entry of the IANA IPv4 Special-Purpose Address Registry: 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 192.168.0.0/16, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24 and 203.0.113.0/24, plus the multicast and reserved space at 224.0.0.0/4 and 240.0.0.0/4. Checking the whole 32-bit integer rather than the first two octets is what catches the /15 and the six /24 exclusions, which is where most generators leak.

CIDR blocks

The block is converted to an unsigned integer range. Network and broadcast are trimmed, except on /31 and /32 where RFC 3021 makes both usable. A random integer inside the remaining range is converted back to dotted notation.

Country ranges

Each country holds several address blocks that the regional internet registries delegated to networks operating there. A block is chosen at random, then an address inside it. This produces addresses that match the allocation pattern a geolocation database would associate with that country, without performing any lookup.

Two caveats, because this is the mode most likely to be misread. The blocks are a representative sample chosen per country, not the complete delegation list, so a generated address will look right to a geolocation database but is not proof that a specific address sits in that country. And delegation follows the registry, not the border: a block delegated to a network headquartered in one country can carry traffic anywhere. If you need an authoritative answer for a real address, that is a geolocation lookup, not a generator.

IPv6

Eight groups are drawn uniformly from 0 to 65535 and rendered as four hex digits. Compressed mode then strips leading zeros and collapses the longest run of zero groups to ::, following the canonical form in RFC 5952. A single zero group is never collapsed, because that is not valid canonical output.

Privacy: generation, validation and export all happen in your browser. No generated address, no typed input and no session data is sent to our servers.

Export Options: TXT, CSV, JSON and IP:PORT

Four ways to get the results into your workflow.

Plain text

One address per line. Paste straight into a config file, firewall rule, allowlist or blocklist.

CSV export

Two columns, ip_address and type. Opens in Excel or Sheets and loads into any database with a CSV importer. The type column records which mode produced each address.

JSON

An array of objects, ready to drop into a test fixture or an API mock with no parsing.

[
  { "ip": "203.45.78.129", "type": "IPv4 Public" },
  { "ip": "192.168.1.47",  "type": "IPv4 Private" },
  { "ip": "2001:db8::1",   "type": "IPv6" }
]

IP:PORT

Switch on Add Port and each address gets a random port between 1 and 65535 appended, giving 203.45.78.129:8080 for socket tests and proxy list fixtures.

FormatExampleBest For
.TXT203.45.78.129Config files, firewall rules
.CSV"203.45.78.129","IPv4 Public"Spreadsheets, database import
.JSON{"ip":"203.45.78.129","type":"IPv4 Public"}Test fixtures, API mocks
IP:PORT203.45.78.129:8080Socket tests, proxy lists

How to Generate a Random IP Address in Code

A browser tool is the fastest way to get a list you can paste. When you need addresses inside a test run, a seeder or a CI job, you want it in the language you are already in. These snippets do the same job as the modes above, including the reserved-range exclusion that most one-liners skip.

Python

import ipaddress, random

def random_public_ipv4():
    while True:
        addr = ipaddress.IPv4Address(random.getrandbits(32))
        # is_global is False for every special-purpose block,
        # which is the check most hand-rolled generators miss
        if addr.is_global:
            return str(addr)

def random_in_cidr(block):
    net = ipaddress.ip_network(block, strict=False)
    return str(ipaddress.ip_address(random.randrange(int(net.network_address), int(net.broadcast_address) + 1)))

print(random_public_ipv4())
print(random_in_cidr("10.10.0.0/16"))

PHP

function random_public_ipv4(): string {
    do {
        $ip = long2ip(random_int(1, 4294967294));
    } while (!filter_var($ip, FILTER_VALIDATE_IP,
             FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE));
    return $ip;
}
echo random_public_ipv4();

JavaScript

const randomIPv4 = () =>
  Array.from({ length: 4 }, () => Math.floor(Math.random() * 256)).join('.');

const randomIPv6 = () =>
  Array.from({ length: 8 },
    () => Math.floor(Math.random() * 65536).toString(16).padStart(4, '0')
  ).join(':');

Shell one-liner

# 100 random IPv4 addresses, one per line
for i in $(seq 100); do
  printf "%d.%d.%d.%d\n" $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256))
done

The trap in every short version: the JavaScript and shell examples above are four random octets and nothing more. They will happily hand you 10.x, 127.x, 224.x and the benchmarking block. That is fine for throwaway output and wrong for anything that will pass through a firewall. The Python and PHP versions use the standard library check, which is why they are longer.

What to Check Before You Trust a Random IP Generator

Most tools in this category are a four-line function behind a button, and for throwaway output that is perfectly fine. If the addresses are going into a test fixture, a firewall rule or a demo somebody else will read, five things are worth checking first.

1. Does it exclude reserved space, or only the private blocks?

Almost every generator filters 10.x, 172.16.x and 192.168.x, then stops. That leaves 198.18.0.0/15 (device benchmarking), the three documentation blocks and 100.64.0.0/10 (carrier-grade NAT) in the output. They look like ordinary public addresses and behave nothing like them once a router sees them. Take a sample of a hundred addresses from any generator and check them against the registry — the leak rate tells you how much thought went in.

2. How many can it produce in one pass?

Caps of 25, 100 or 300 are common. That is fine for a screenshot and slow when you are seeding a table with a few hundred rows and have to click Generate six times.

3. Can it stay inside a subnet?

If your lab is 10.10.0.0/16, addresses from anywhere else are noise. Subnet support is the difference between a tool you can point at a real environment and one that only produces decoration.

4. What comes out at the end?

A list on screen is the minimum. CSV and JSON remove a reformatting step, and that step is where copy-paste errors get introduced.

5. Does it suggest the output can hide your address?

Some do, including a few from names you would expect to know better. Close the tab. A generator produces text, it cannot change the return address on your packets, and a page confused about that is not a page to trust on the technical details either. The guide to checking whether your VPN is actually hiding your IP covers what does work.

A one-minute test for any generator: ask it for a hundred public addresses and search the list for anything starting 198.18, 198.19, 192.0.2, 198.51.100 or 203.0.113. Those five prefixes are reserved and should never appear. If they do, the tool is checking the first octet or two and calling it done.

Random IP Generator: Frequently Asked Questions

What is a random IP address generator?

A random IP address generator creates syntactically valid IPv4 or IPv6 addresses that are not tied to any particular user or device. They are used for software testing, database seeding, network simulation, and teaching, wherever realistic looking address data is needed without touching real user records.

Are generated IP addresses real or fake?

They are correctly formatted but arbitrary. An address this tool produces may or may not currently be routed by some network somewhere, because the public IPv4 space is largely allocated. What it is not is a record belonging to a specific person, and it carries no traffic. For code that parses or validates addresses it behaves exactly like a real one.

Can I generate IPs inside a specific CIDR block?

Yes. Switch to CIDR Block mode and enter any notation such as 192.168.1.0/24. The tool calculates the usable host range for that subnet, excludes the network and broadcast addresses, and generates only inside it. The host count updates live as you type so you know how many distinct addresses exist.

What export formats are supported?

Plain text with one address per line, CSV with an address column and a type column ready for a spreadsheet, and JSON as an array of objects for test fixtures. You can also switch on IP:PORT format, which appends a random port between 1 and 65535 to every address for socket and proxy testing.

What does the No Duplicates toggle do?

It tracks every address produced in the current batch and discards repeats before they reach the list, so each exported address is distinct. If the range you picked contains fewer addresses than you asked for, the tool tells you how many were actually available rather than quietly returning a short list.

Can I use a generated IP to hide my identity online?

No. A generated address is text. It routes nothing and changes nothing about how your traffic reaches a website. Hiding your real address requires a VPN or proxy that actually carries your packets. To check whether yours is working, run our WebRTC leak test.

How does Country Range mode work?

Country mode is an IP address generator by country. It draws from a representative sample of the address blocks that the regional internet registries have delegated to networks operating in each of ten countries. A block is picked at random, then an address inside it. The result matches the allocation pattern a geolocation database associates with that region, but it is a sample rather than the complete delegation list, so treat it as realistic test data and not as an authoritative country mapping.

What does IP Validator mode check?

For IPv4 it reports the class, the type (public, private, loopback, link-local, multicast or broadcast), the 32-bit integer value, the binary form of all four octets, the in-addr.arpa reverse DNS name, and whether the address is publicly routable. For IPv6 it parses the address properly, including compressed and IPv4-mapped forms, and rejects malformed input rather than accepting anything that merely looks close.

Related Network & IP Tools

Pair the generator with the rest of the TrustMyIP toolkit.

Stop Hardcoding
The Same Three Test IPs

Generate hundreds of correctly formatted addresses with CIDR, country ranges and export options, filtered against the full reserved registry.