Random Port Generator
Generate random, unused TCP/UDP port numbers above the reserved range — pick from the registered or dynamic/private IANA ranges and skip ports common services already use.
Input
Output
Your results will appear here.
Guides
What this tool does
It picks random TCP/UDP port numbers that are safe to bind a local service to, skipping the reserved range and, optionally, the ports that popular services already claim.
The three port ranges
The IANA divides the 16-bit port space into three parts:
0–1023 — well-known / system ports. HTTP, SSH, DNS and friends live here. On Unix-like systems binding one requires root. This tool never generates them.
1024–49151 — registered ports. Assigned to specific applications on request, but usable by anyone in practice. PostgreSQL's 5432 and MySQL's 3306 sit in here.
49152–65535 — dynamic / private ports. Reserved for ephemeral use and never officially assigned. This is the safest range to grab if you just need a port and don't care which. It's also the range your OS draws from for outbound connections, so a long-running service here can very occasionally collide with an ephemeral client socket.
How to use it
Choose how many ports you want, pick a range, and click Generate. Ports within a single run are always distinct.
Avoiding common ports
The "avoid ports common services use" option skips a list of numbers that are technically free but are conventionally taken — 3000, 3306, 5432, 6379, 8080, 8443, 27017 and others. Leave it on if the port is going into a config file that a colleague will later run alongside their own Postgres and Redis.
Does a generated port mean it's actually free?
No. This tool has no way to inspect your machine. It produces a number that is plausibly free; whether something is already listening on it is a separate question. On Linux or macOS you can check with:
lsof -i :PORTAn empty result means nothing is bound.
Privacy
Ports are generated in your browser using Math.random(). Nothing is transmitted or stored. Because it's Math.random() and not a cryptographic source, don't use these numbers for anything where unpredictability matters for security.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/random-port-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"count": "1",
"range": "any",
"avoidCommon": "true"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `random-port-generator` tool (Random Port Generator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.