Random Port Number Generator

Choose a port range and how many ports you need, and press Generate ports. Ports used by well-known services such as SSH, HTTP, MySQL, or Redis are skipped unless you allow them.

Try a preset

About this port number generator

TCP and UDP port numbers run from 0 to 65535, and IANA divides them into three ranges. Well-known ports (0–1023) belong to core services such as HTTP on 80 and SSH on 22, and usually need administrator rights to open. Registered ports (1024–49151) are assigned to applications such as MySQL on 3306 or PostgreSQL on 5432. Dynamic or private ports (49152–65535) are never assigned and are the safest choice for your own services, test servers, and temporary connections. This generator picks ports at random from the range you choose and, by default, skips about fifty ports that popular software uses, so the port you get is unlikely to clash with something already running.

How to pick a random port

  1. Choose a range. Use the dynamic range for your own services, or enter a custom range such as 3000 to 9999.
  2. Set the options. Keep common services skipped and duplicates off, and choose how many ports you need.
  3. Press Generate ports. Copy the list and check the table for each port’s range. Confirm the port is free on your machine before using it.

Frequently asked questions

Which port range should I use for my app?

The dynamic range, 49152 to 65535, is never assigned to any service, so it is the least likely to clash. Many developers also use 3000–9999 for local servers.

How do I check whether a port is free?

On macOS or Linux run lsof -i :PORT, and on Windows run netstat -ano | findstr :PORT. No output means nothing is listening on that port.

Why do ports below 1024 need admin rights?

On Unix-like systems they are privileged ports, reserved for system services, so only root can open them. Pick a higher port to run without special permissions.

Is port 0 valid?

Port 0 is reserved. Asking the operating system to bind to port 0 means let it choose any free port, so it is not used as a fixed service port.

Do TCP and UDP share port numbers?

They use the same numbering, but a TCP port and a UDP port with the same number are separate, so a service can listen on 53/TCP and 53/UDP at once.