Generate random TCP or UDP port numbers in any range, automatically skipping well-known and commonly bound service ports so your local services do not collide.
A port number nobody else on your machine is likely to want. Choose how many ports you need and the range to draw from. Ports belonging to well-known services are skipped by default, so the numbers you get are unlikely to clash with something already running.
–
Choosing a port number that will not collide
How the port space is divided
A TCP or UDP port is a 16-bit number, so the usable range runs from 0 to 65535. IANA splits that space into three parts. Ports 0 to 1023 are the system or well-known ports, reserved for standard services such as HTTP on 80 and SSH on 22; on Unix-like systems binding one of them normally requires root or an explicit capability. Ports 1024 to 49151 are registered ports, assigned on request to specific applications - PostgreSQL on 5432 and MySQL on 3306 live here. Ports 49152 to 65535 are the dynamic or ephemeral range, reserved for temporary client-side allocations.
For a local development service, the sweet spot is the registered range above 1024, avoiding both the privileged block and the ephemeral block. That is why this generator defaults to 1024 as the lower bound. Staying below 49152 matters more than it sounds: your operating system draws from the ephemeral range every time a program opens an outbound connection, so a service parked there can find its port already taken after a reboot.
Why skipping well-known ports helps
Randomness alone does not prevent collisions. A random draw could easily land on 3306, 5432, 6379 or 8080, and on a working developer machine those are exactly the numbers most likely to be occupied already. The skip list used here covers the classic Unix services, the common databases and message brokers, and the ports that popular frameworks pick by default, such as 3000 for Node tooling and 8000 or 8080 for local HTTP servers.
Skipping them costs almost nothing - the pool still contains tens of thousands of candidates - and it removes the most common source of a "port already in use" error. If you deliberately want one of those numbers, turn the option off and the full range becomes available again.
Keep in mind that this is a probabilistic aid, not a reservation. The tool has no way to inspect your machine, so it cannot know that something is listening. To confirm a port is genuinely free, check it locally with lsof -i :PORT on macOS or Linux, ss -ltnp on modern Linux, or netstat -ano | findstr :PORT on Windows.
Ports in containers and CI
Container and CI environments change the calculation. Inside a container the port space is usually private, so two containers can both listen on 8080 without conflict; the collision risk moves to the host side, where published ports share one namespace. Picking a random host port and mapping it to a fixed container port is a common way to run several copies of the same service side by side.
Many CI systems and orchestration tools solve this differently by asking the kernel for a free port: bind to port 0, and the operating system assigns an unused one and tells you which it chose. That is race-free and always correct, so prefer it when your program can be told its port at runtime. A generated number like the ones here is the right tool when you need a stable value to write into a configuration file, a docker-compose mapping or a team document before anything is running.
FAQ
Why does the range start at 1024 by default?
Ports below 1024 are privileged on Unix-like systems and normally require root to bind. Starting at 1024 keeps the results usable by an ordinary user account.
Should I avoid ports above 49152?
Usually yes for a long-lived service. That range is where the operating system draws ephemeral client ports, so a service parked there can find its number already claimed after a restart.
Does this check whether the port is actually free?
No. The page runs entirely in your browser and cannot inspect your system. Verify with `lsof -i :PORT`, `ss -ltnp` or `netstat -ano | findstr :PORT` before committing to a number.
Which ports does the skip option exclude?
The classic Unix services, common databases and brokers such as MySQL, PostgreSQL, Redis, RabbitMQ, MongoDB and Elasticsearch, and popular framework defaults like 3000, 8000, 8080 and 8443.
Is the randomness cryptographically secure?
It uses the Web Crypto API when the browser provides it, with rejection sampling so the draw stays uniform, and falls back to Math.random only when Crypto is unavailable.
What is the difference between a TCP and a UDP port?
They are separate 65536-entry spaces, so TCP 8080 and UDP 8080 are unrelated and can be used by different programs at the same time. The numbers this tool generates work for either.