Random IP Address Generator

Generate random IP addresses for network testing, development, security applications, and more. Create custom IPv4 and IPv6 addresses with specific ranges and formats, perfect for developers, network engineers, and security professionals.

IPv4 Generator
IPv6 Generator

About IP Addresses

IP (Internet Protocol) addresses are numerical labels assigned to devices connected to a computer network that uses the Internet Protocol for communication. IP addresses serve two main functions: identifying the host or network interface, and providing the location of the host in the network.

IPv4 vs IPv6

Feature IPv4 IPv6
Format 32-bit number (4 bytes) 128-bit number (16 bytes)
Notation Dotted decimal (e.g., 192.168.1.1) Hexadecimal with colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334)
Number of addresses ~4.3 billion (2^32) ~340 undecillion (2^128)
Private ranges 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 fc00::/7 (Unique Local Addresses)
Loopback 127.0.0.1 ::1

Common IPv4 Address Ranges

Range Type Address Range Description
Class A Private 10.0.0.0 - 10.255.255.255 Used for large private networks
Class B Private 172.16.0.0 - 172.31.255.255 Used for medium-sized private networks
Class C Private 192.168.0.0 - 192.168.255.255 Used for small private networks (home networks)
Loopback 127.0.0.0 - 127.255.255.255 Reserved for loopback (localhost)
Link-Local 169.254.0.0 - 169.254.255.255 Assigned automatically when DHCP fails
Note: This generator creates random IP addresses for testing purposes. The generated IP addresses may or may not be assigned to actual devices on the internet. Never use these addresses for unauthorized scanning, probing, or any malicious activities.

Using the IP Address Generator in Your Projects

Here are some common use cases for our IP Address Generator:

Sample Code for Generating Random IP Addresses

// JavaScript function to generate a random IPv4 address
function generateRandomIPv4() {
  return Array(4).fill(0).map((_, i) => {
    return Math.floor(Math.random() * 256);
  }).join('.');
}

// JavaScript function to generate a random IPv6 address
function generateRandomIPv6() {
  return Array(8).fill(0).map((_, i) => {
    return Math.floor(Math.random() * 65536)
      .toString(16)
      .padStart(4, '0');
  }).join(':');
}

// Generate a random private IPv4 address
function generateRandomPrivateIPv4() {
  // Choose one of the private address ranges
  const ranges = [
    [10, 0, 0, 0, 10, 255, 255, 255],        // 10.0.0.0 - 10.255.255.255
    [172, 16, 0, 0, 172, 31, 255, 255],      // 172.16.0.0 - 172.31.255.255
    [192, 168, 0, 0, 192, 168, 255, 255]     // 192.168.0.0 - 192.168.255.255
  ];
  
  const range = ranges[Math.floor(Math.random() * ranges.length)];
  
  // Generate random IP within the selected range
  const ip = [];
  for (let i = 0; i < 4; i++) {
    const min = range[i];
    const max = range[i + 4];
    ip.push(Math.floor(Math.random() * (max - min + 1)) + min);
  }
  
  return ip.join('.');
}