Skip to content

Generate random unprivileged network port numbers (1024-65535) locally.

Loading tool

About Random Port Generator

Picks random TCP/UDP port numbers within a range, by default 1024 to 65535, using crypto.getRandomValues. You can restrict results to the dynamic range 49152-65535, skip well-known ports below 1024, avoid commonly used service ports such as 3000, 5432, 6379, 8080 and 27017, require unique values and sort the output.

Common uses

  • Choose a port for a new local dev server that will not clash with others
  • Assign ports to containers or services in a docker-compose file
  • Pick random ports for integration tests

FAQ

What are well-known, registered and dynamic ports?
IANA divides ports into well-known (0-1023), registered (1024-49151) and dynamic or private (49152-65535). On Unix-like systems, binding below 1024 traditionally requires root.
Which ports are safe to use for a local service?
Any free port above 1023 works. The dynamic range 49152-65535 is never assigned by IANA, but operating systems also use it for outgoing connections, so a registered-range port that no local service uses is often a better fixed choice.
How do I check if a port is already in use?
On macOS and Linux run 'lsof -i :PORT' or 'ss -ltnp'; on Windows run 'netstat -ano | findstr :PORT'.