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
Random Ip Generator Examples (click to try!)
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)
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
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
How Does This Random Ip Generator Work?
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
endIpDec are created. Then, it checks if generating private addresses is allowed (private addresses are 0.0.0.0, 10.0.0.0, 18.104.22.168, 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 web developer 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.