Skip to content
cosmodev ~/tools/random-port-generator

Γεννήτρια τυχαίων θυρών

Generators

Δημιουργήστε έναν ή πολλούς τυχαίους αριθμούς θυρών TCP/UDP σε registered, ephemeral ή το πλήρες εύρος — προαιρετικά μοναδικούς. Τρέχει εξ ολοκλήρου στον browser σας με τυχαιότητα κρυπτογραφικού επιπέδου.

Θύρες
Πατήστε «Δημιουργία» για να κληρωθούν θύρες.

Δημιουργείται τοπικά με crypto.getRandomValues — δεν μεταδίδεται ποτέ.

(Τεκμηρίωση στα αγγλικά)

What it does

Generates random TCP/UDP port numbers from the band you pick. The tool generates on load and on every option change. Choose the Range (Registered, Ephemeral, or Any), set Count from 1 to 1,000, and toggle Unique when the ports must not repeat. A single value renders in large type; a batch renders as a list. Randomness comes from crypto.getRandomValues locally.

How to use it

  1. Pick a Range. Registered (1024-49151) is the default and the usual choice.
  2. Set Count (1 to 1,000).
  3. Toggle Unique if the ports must be distinct.
  4. Copy the result.

Examples

Five unique ports from the registered band: 32764, 21044, 48812, 18377, 40291.

Three ports from the ephemeral band: 52143, 49872, 61009.

Every value in both lists sits inside its band. That is the tool’s one job, and Unique guarantees it also never repeats.

How TCP ports work

A port is a 16-bit number: 1 to 65535. IANA splits that space into three bands:

Band Range Values Used for
Well-known 1-1023 1,023 system services: HTTP 80, HTTPS 443, SSH 22, DNS 53
Registered 1024-49151 48,128 applications registered with IANA: MySQL 3306, PostgreSQL 5432
Ephemeral 49152-65535 16,384 client-side outbound connections, picked by the OS

Why a developer picks the registered band for a local service:

  1. Below 1024, binding needs root or administrator privileges. sudo for a dev server is the wrong trade.
  2. Inside 49152-65535, the OS may hand your port to any outbound connection at any moment. Your listener then races the OS and can fail to bind.
  3. The registered middle is quiet by default: 48,128 values that only popular daemons claim. Pick one at random, avoid the famous few (3306, 5432, 6379, 8080), and collisions vanish.

How Unique works. The tool runs a partial Fisher-Yates shuffle over the whole band and takes the first count results - every port distinct by construction, no rejection loop. The bound is arithmetic: the ephemeral band holds 16,384 values, so asking for 20,000 unique ephemeral ports is impossible. When count exceeds the band size, generation fails and the tool clears the results. Widen the range or lower the count.

Good to know

  • Unique costs nothing until you exceed the band size; then it fails loudly instead of silently repeating.
  • One port, one protocol. A TCP port and a UDP port with the same number are separate endpoints; this tool generates numbers, not bindings.
  • Private: randomness comes from crypto.getRandomValues locally.
  • Related tools: MAC Address Generator, ULIDULIDA 128-bit identifier like a UUID, but timestamp-prefixed and Crockford-base32 encoded — so it sorts by creation time and is shorter to read. Generator.
Πηγαίος κώδικας14 γλώσσες

100% client-side · τα δεδομένα σου δεν φεύγουν ποτέ από τον browser. Σου φάνηκε χρήσιμο; Μοιράσου το με έναν συναδέλφο.