Skip to content

Random Port Generator

Generate random port numbers within specified ranges for development, testing, and network configuration.

Random Port Generator tool

Loading...

Example

Input: Port Range Dynamic / Private (49152 - 65535), Count 5, then Generate Ports

Result: Generated Ports (5): five unique random ports between 49152 and 65535, sorted ascending, different on every run

The dynamic range is never assigned to services by IANA, so it is the safest choice for local development servers and temporary listeners.

Common Service Ports the Generator Labels

PortServiceBand
22SSHWell-known
25SMTPWell-known
53DNSWell-known
80HTTPWell-known
443HTTPSWell-known
1433MSSQLRegistered
3306MySQLRegistered
3389RDPRegistered
5432PostgreSQLRegistered
5672AMQPRegistered
6379RedisRegistered
8080HTTP AltRegistered
9200ElasticsearchRegistered
27017MongoDBRegistered

A sample of the 57 ports the tool labels and can exclude.

  1. Pick a port range: well-known (1-1023), registered (1024-49151), dynamic (49152-65535), or a custom minimum and maximum.
  2. Set how many ports you want (up to 50). Turn on "Exclude common service ports" to skip ports used by well-known services.
  3. Click "Generate Ports" to get unique random ports in that range, sorted from low to high.
  4. Check each port for a service label, which marks a port that a common service uses.
  5. Copy single ports or use "Copy All" for the whole list.

Picking a Port Number for Development and Testing

The Random Port Generator picks unique random TCP or UDP port numbers from a range you choose. Port numbers run from 0 to 65535, and IANA splits them into three bands: well-known (0 to 1023), registered (1024 to 49151) and dynamic or private (49152 to 65535). Choose a band or set your own minimum and maximum, then ask for 1 to 50 ports. The results are sorted from low to high and never repeat. Port 0 is never produced, since it is reserved. Each number comes from the browser crypto API with rejection sampling, a method that gives every port in the range the same chance.

Which band should you use? Well-known ports below 1024 usually need admin or root rights. They belong to core services like SSH (22) and HTTPS (443). The registered band holds most app defaults, such as 3306 for MySQL and 5432 for PostgreSQL. The dynamic band is never assigned to a service. However, your operating system also uses part of it for outgoing connections, so a busy machine may briefly hold a port you picked.

The tool labels any result that matches one of 57 common service ports in its list. The "Exclude common service ports" switch skips them entirely. It cannot see your machine, so it does not know which ports are actually free. Check before you bind, as shown in the questions below. For random numbers of any other kind, use the Random Number Generator.

Sources

Frequently Asked Questions

Any unused port above 1023 works without admin rights on most systems. Popular picks such as 3000, 5000, 8000 and 8080 are easy to remember, but that popularity is also why they clash between projects. A random port from the registered or dynamic band avoids that. Check that it is free, then save it in your project config so everyone uses the same one.
On macOS or Linux, run lsof -i :PORT, or ss -ltnp on Linux, and look for a listener. On Windows, run netstat -ano | findstr :PORT, where the last column is the process ID. If nothing is listed, the port is free right now. This generator cannot run these checks, because a web page cannot see which ports are open on your computer.
The highest port is 65535, because the port field in TCP and UDP headers is 16 bits long, which allows 65,536 values from 0 to 65535. Port 0 is reserved and is not used as a normal listening port. The dynamic band at the top, 49152 to 65535, holds 16,384 ports.
Yes. They use the same 0 to 65535 numbering, but they are separate spaces. One program can listen on TCP 5000 while another uses UDP 5000 without a conflict. IANA often registers a service on both protocols under the same number, such as DNS on 53, even when it mostly uses one of them.

Related Tools

Random Number Generator

Generate random numbers within a range with options for count, uniqueness, and sorting.

Math and Numbers

IPv4 Subnet Calculator

Calculate network address, broadcast address, host range, subnet mask, and wildcard mask from any IP and CIDR prefix.

Network Tools

UUID Generator

Generate random UUIDs in v4 and v7 formats with bulk generation and one-click copy support.

Developer Tools

MAC Address Generator

Generate random MAC addresses with optional OUI prefix in colon, hyphen, or dot notation formats.

Network Tools