Star on GitHub
GitHub

randoport

Generate secure, random network ports instantly for development, testing, and production.

Automatic Conflict Avoidance: randoport automatically excludes ports reserved by the system, common applications, dev services, and utilities. It actively avoids default ports used by common services (like PostgreSQL on 5432, MySQL on 3306, Redis on 6379, and standard web/React servers on 3000, 8080) and consults registries such as the IANA Service Name and Transport Protocol Port Number Registry to ensure the generated ports are safe to use.
Registered (1024-49151): Ideal for specific services that need to be consistently accessible (e.g., a local database or dev server).
Ephemeral (49152-65535): Best for short-lived, temporary connections or when you want to absolutely avoid any potential system conflict.