Skip to main content

Random Port Generator

Developer

Spinning up a fleet of test containers, assigning source ports to a load test, or handing out ports to a dozen local services — typing 8000, 8001 by hand collides with something already running. This generates distinct ports inside a range, defaulting to 1024 and above so you never hit a port that needs root.

Loading tool…

How to use

4 steps
  1. 01

    Set the count and range (1024–65535 by default) and press Generate again for a new batch.

  2. 02

    One port per line, ready to paste into a shell loop or a compose `-p` list.

  3. 03

    A narrow range reports “not enough ports” rather than silently repeating values.

  4. 04

    These are free *numbers*, not confirmed free ports — check with `lsof -i :PORT` or `ss -lntp` before binding.

Technical Notes & Guide

1

Why start at 1024

0–1023 is the IANA well-known range; binding there needs root or `CAP_NET_BIND_SERVICE`, so an unprivileged service gets `permission denied`. 1024–49151 are registered ports, and 49152–65535 are ephemeral — the range your OS picks client source ports from, worth avoiding when you allocate ports for load tests.

FAQ

2 questions
Q1Are these ports actually free?

Unknown — a browser cannot read your socket table. Uniqueness is guaranteed within the batch, real availability must be checked locally.

Q2How do I check whether a port is in use?

Linux/macOS: `lsof -i :8080` or `ss -lntp | grep 8080`. Windows: `netstat -ano | findstr :8080`.

Developer