Overview
Draws batches of unique random TCP/UDP port numbers from the registered range (1024-49151), the ephemeral range (49152-65535), or both, automatically excluding a built-in list of 21 heavily used service ports such as 22, 80, 443, 3306 and 5432. Results are unique within a batch and rendered as click-to-copy chips.
How It Works
Pick a range - 1024-49151, 49152-65535, or All - set the count between 1 and 100, and press Generate. The ports appear as chips, each click-to-copy, and the batch regenerates completely on every press. Duplicates within a batch are impossible: the generator collects into a set until it has the count you asked for, and well-known service ports never appear at all.
Step-by-Step Usage Guide
- Choose the range: registered for services you define, ephemeral for throwaway listeners, or All for general use.
- Set the batch size and press Generate. Every port in the batch is unique.
- Click a chip to copy a single port, or read the whole batch from the chips directly.
- Re-roll if a port happens to collide with something on your machine - the exclusion list reduces, but cannot eliminate, conflicts.
Technical Specifications & Standards
The ranges follow the IANA port-number registry structure: 0-1023 are the well-known (system) ports, 1024-49151 the registered (user) ports, and 49152-65535 the dynamic, private or ephemeral ports that operating systems hand out for outbound connections - a division administered through the RFC 6335 procedures. The All option spans 1024-65535, skipping the well-known range entirely, since binding anything below 1024 requires privileges on Unix and is pointless for a test listener. The exclusion list is a curated denylist of 21 ports you will meet in practice - FTP 21, SSH 22, telnet 23, SMTP 25, DNS 53, HTTP 80, POP3 110, IMAP 143, HTTPS 443, and the databases and app servers: 3306 (MySQL), 3389 (RDP), 5432 (PostgreSQL), 5900 (VNC), 8080, 8443, 6379 (Redis), 27017 (MongoDB) - so a generated port is far less likely to collide with something already listening. Uniqueness within a batch comes from set semantics, not rejection sampling on output. One honest note: the randomness is Math.random, which is fine for port selection - ports are not secrets - but this tool should not be your source for anything security-critical.
Targeted Use Cases
- Picking a listen port for a dev server, mock API or local service without colliding with common daemons.
- Generating port sets for test matrices - config files, docker-compose port mappings, firewall test cases.
- Choosing ephemeral-range ports for integration tests that must not touch IANA-registered territory.
- Teaching the IANA port ranges and why 0-1023 is off-limits without privileges.
Notes & Gotchas
- Check the port is actually free on your machine before binding - the exclusion list is a heuristic, not a live check.
- Use the ephemeral range for temporary listeners so you never squat on a registered service's territory.
- Avoid reusing the same generated port across parallel test runs; unique-within-batch does not mean unique-between-batches.
- Use a proper secrets generator for anything random that must be unguessable - ports are not secrets, and this tool uses Math.random accordingly.
Frequently Asked Questions
Why are ports below 1024 excluded?
That is the well-known range, reserved for system services and requiring root privileges to bind on Unix-like systems. Generating from it would produce ports you usually cannot use, so all three range options start at 1024.
What is the difference between registered and ephemeral ports?
Registered ports (1024-49151) are the range IANA accepts service registrations for - where your own services belong. Ephemeral ports (49152-65535) are what operating systems assign for outbound connections and are never registered. Both are valid for a private listener; ephemeral is safer for anything short-lived.
Why does the tool skip ports like 8080 and 3306?
They are on a built-in exclusion list of 21 ports that common services actually listen on - databases, proxies, RDP, Redis and friends. Skipping them makes a collision with something already running on your machine much less likely.
Can the same port appear twice in one batch?
No. Ports are collected into a set until the requested count is reached, so every value in a batch is distinct. Across batches, repetition is possible and expected.