Random Port Generator
Pick random, unused-range TCP/UDP port numbers for local services, locally.
Pick random port numbers within a range you set
This tool generates one or more random integers between a Min and Max you set, defaulting to 1024-65535, the non-privileged and ephemeral range, and deduplicates them so a batch never repeats a number, capped at however many ports actually exist in the range. It's useful for picking a port for a local dev server, a docker-compose mapping, or a config file, when you want a number unlikely to collide with a commonly used default. It does not check whether the port is actually free on your machine or network; it only generates a number.
How to use the Random Port Generator
- Set Min and Max to the port range you want to draw from.
- Set Count for how many distinct ports to generate at once.
- Click Generate for a fresh batch, or reload the page for the default range.
- Copy a single port, or use Copy all to grab the whole list.
The default range, 1024-65535, avoids the well-known ports below 1024 that are reserved for standard services. Numbers within a batch are always unique, but the tool has no way to check whether a given port is actually free on your machine or network.
Frequently asked questions
- what port range should I use for a local dev server?
- Ports 1024-65535 avoid the privileged range reserved for standard services like HTTP or SSH. This is the tool's default, and it's a common convention for local development servers and ad hoc services.
- does this check if the port is actually free on my machine?
- No, it only generates a number within the range you set. It doesn't query your operating system or network, so confirm the port isn't already bound before using it.
- can I generate multiple random ports without duplicates?
- Yes, set Count to the number you need. The generator keeps drawing until it has that many distinct values, capped at however many ports actually exist in your chosen range.
- what's the difference between well-known, registered and ephemeral ports?
- Well-known ports, 0-1023, are reserved for standard services; registered ports, 1024-49151, are used by named applications; ephemeral ports, 49152-65535, are assigned temporarily by the OS. The tool's default range spans the latter two.