I often have to generate random IP addresses so I created this simple online utility that does it for me. It lets you generate however many random IPv4s you need from any IP range. It works in the browser and is powered by alien technology from the future.

Random Ip Generator Options

IP Addresses Range
Private IP Addresses
Generate IP addresses in range 0.0.0.0 – 0.255.255.255.
Generate IP addresses in range 10.0.0.0 – 10.255.255.255.
Generate IP addresses in range 172.16.0.0 – 172.31.255.255.
Generate IP addresses in range 192.168.0.0 – 192.168.255.255.
IP Addresses Format
Convert four-octet values to single-number values.

Random Ip Generator Examples (click to try!)

Class B Networks
In this example, we generate eight random IP addresses from the private class B networks. The private class B networks span a 20-bit block and consist of 1,048,576 IP addresses in the range 172.16.0.0 – 172.31.255.255. We print each address on a new line and we also display the numeric decimal IP in parentheses next to each address.
172.30.248.34 (2887710754)
172.17.112.152 (2886824088)
172.20.182.201 (2887038665)
172.30.182.228 (2887694052)
172.29.80.58 (2887602234)
172.24.230.193 (2887313089)
172.26.67.253 (2887402493)
172.24.49.55 (2887266615)
IP start value.
IP end value.
How many IPs to generate?
Separate random IPs with this symbol. (Newline by default.)
Separate IP octets with this symbol. (Dot by default.)
Allow 0.0.0.0
Allow 10.0.0.0/8
Allow 172.16.0.0/12
Allow 192.168.0.0/16
Print Numeric IP
Decimal Base
Hex IPv4 Addresses
This example creates twenty random hexadecimal addresses in the range 0.0.0.0 to 192.168.255.255. This range includes public and private IP addresses. From the private address space, we allow only 10.0.0.0/8 (class B networks) and 192.168.0.0/16 (class C networks). We separate IP addresses by the comma character and put the "-" symbol between pairs of hex nibbles.
b8-b9-84-74, a9-4b-f6-8b, b5-59-8f-89, 4b-47-30-bd, b6-15-64-bf, ac-ec-3c-43, ba-91-22-35, 30-e2-70-08, b1-9d-4c-4b, 7d-6e-12-64, bb-a6-d4-4a, af-8f-d1-52, b1-8d-1c-60, 73-e9-cb-7c, 0e-ab-32-e6, b6-50-2c-59, b7-a5-21-03, b4-b7-56-93, a2-72-73-16, 9f-45-e0-b1
IP start value.
IP end value.
How many IPs to generate?
Separate random IPs with this symbol. (Newline by default.)
Separate IP octets with this symbol. (Dot by default.)
Allow 0.0.0.0
Allow 10.0.0.0/8
Allow 172.16.0.0/12
Allow 192.168.0.0/16
Print Numeric IP
Hexadecimal Base
Avoid Private IP Addresses
In this example, we use the maximum range of addresses (from 0.0.0.0 to 255.255.255.255) but disallow all private addresses and zero networks. We generate ten random addresses in the custom base of 36 and output them in a vertical column.
6.d.38.36
53.2p.3i.4a
6f.1y.41.5z
4z.5y.5j.s
58.2o.55.1l
52.3j.41.21
4y.4j.o.59
51.71.4j.26
20.1e.5v.x
6v.1t.1a.15
IP start value.
IP end value.
How many IPs to generate?
Separate random IPs with this symbol. (Newline by default.)
Separate IP octets with this symbol. (Dot by default.)
Allow 0.0.0.0
Allow 10.0.0.0/8
Allow 172.16.0.0/12
Allow 192.168.0.0/16
Print Numeric IP
Custom Base
If you selected a custom base, set its value here. Valid bases are from 2 to 64.

How Does This Random Ip Generator Work?

This random IP generator works entirely in your browser and is written in JavaScript. The first step it takes in generating random addresses is processing the input options. In the options, you can enter startIp and endIp IP version 4 values. They consist of four octets (8-bit values) that are in the form a.b.c.d. Each octet takes values from 0 to 255 and they can be converted to a single decimal value using the formula a×256×256×256 + b×256×256 + c×256 + d. This formula can also be written as a<<24 + b<<16 + c<<8 + d. This way, integer values startIpDec and endIpDec are created. Then, it checks if generating private addresses is allowed (private addresses are 0.0.0.0, 10.0.0.0, 176.12.0.0, or 192.168.0.0). If all of them are allowed, then it creates a range [startIpDec, endIpDec]. If any of private addresses are disabled, then for each disabled private address range, it cuts it out from the interval [startIpDec, endIpDec], creating multiple smaller ranges [[start1, end1], [start2, end2], …]. There can be up to four such smaller ranges (there are exactly four when all private addresses are prohibited). To generate a random IP address from the allowed ranges, the program calls the Math.random() function twice. First, it randomly selects one of the ranges and then randomly selects a number from this range. After generating count random addresses, it converts the numerical IP form back to the dotted form. The formula for individual octets is the following: a = (dec>>24)&0xff, b = (dec>>16)&0xff, c = (dec>>8)&0xff, d = dec&0xff. If a non-decimal base is selected, then it converts each octet to the new base using the bignumber.js library. It first creates a big number for each octet: a = new BigNumber(a) and then turns it into a string in the desired base by calling a = a.toString(base). After getting all octets in the required base, it concatenates them with the octetSeparator character (can be set in options) and then prints all addresses to the screen by placing the ipSeparator character (also can be set in options) between them.

Created by Browserling

This random ip generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by our programmer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my tools, then I love you, too! Use coupon code TOOLLING to get a discount at my company.