Random Port Generator
Generate bias-free random TCP/UDP ports with IANA service lookup, conflict risk assessment, and batch export.
How to Use
Generate cryptographically random TCP/UDP port numbers for development, testing, and infrastructure configuration — entirely in your browser using crypto.getRandomValues() with rejection sampling to eliminate modulo bias.
- Select a port range — choose from All (1–65535), System (1–1023, requires root), Registered (1024–49151, IANA-assigned), or Dynamic/Ephemeral (49152–65535, safest for development).
- Set the count — generate 1 to 100 ports at a time. Enable "Unique ports only" to prevent duplicates in your batch.
- Filter known services — toggle "Exclude known service ports" to avoid ports already assigned to common services like MySQL (3306), Redis (6379), or PostgreSQL (5432).
- Review conflict risk — each generated port shows its IANA service assignment (if any), protocol (TCP/UDP), and a color-coded risk indicator (high for critical infrastructure ports, medium for common services, low for development servers).
- Export results — copy or download ports in .env, Docker Compose, JSON, or plain text format. The export preview updates live as you switch formats.
- Look up any port — enter a port number (0–65535) in the Port Lookup section to instantly check its IANA service assignment and conflict risk.
About This Tool
TCP and UDP ports are 16-bit unsigned integers (0–65535) that identify specific processes or services on a networked host. The Internet Assigned Numbers Authority (IANA) maintains the Service Name and Transport Protocol Port Number Registry, which divides the port space into three ranges with different assignment policies.
Port Range Classification
System Ports (0–1023) are reserved for well-known services like HTTP (80), HTTPS (443), SSH (22), and DNS (53). Binding to these ports typically requires root/administrator privileges. Using them for development risks conflicting with critical system services.
Registered Ports (1024–49151) are assigned by IANA to specific applications — MySQL (3306), PostgreSQL (5432), Redis (6379), MongoDB (27017), and hundreds of others. While any user can bind to these ports, doing so may conflict with installed services.
Dynamic/Ephemeral Ports (49152–65535) are unassigned by IANA and intended for temporary use by client applications. This is the safest range for development servers, testing, and CI/CD pipelines because conflicts are extremely unlikely.
Bias-Free Random Generation
This tool uses the Web Crypto API (crypto.getRandomValues()) with rejection sampling to ensure uniform distribution across the selected range. Naive Math.random() % range approaches introduce modulo bias — certain ports become slightly more likely than others. Rejection sampling discards values that would cause bias, guaranteeing each port in the range has exactly equal probability.
IANA Service Database
The tool includes a curated database of 80+ commonly used port assignments covering system services (SSH, HTTP, DNS, SMTP), databases (MySQL, PostgreSQL, MongoDB, Redis, Elasticsearch), message brokers (Kafka, RabbitMQ, MQTT), container orchestration (Docker, Kubernetes), and popular development servers (Vite, Next.js, Angular, Astro). Each entry includes the service name, protocol (TCP/UDP), and a conflict risk assessment.
Why Use This Tool
Choosing port numbers for development and testing is surprisingly error-prone. Here are the most common scenarios where this tool helps:
- Microservice development — when running 5+ services locally, each needs a unique port. Random generation from the dynamic range eliminates manual tracking and avoids collisions with installed services.
- Docker Compose configurations — map container ports to random host ports to prevent
bind: address already in useerrors. Export directly to Docker Compose YAML format. - CI/CD test isolation — parallel test suites need non-conflicting ports. Generate a batch of unique ports and export as .env variables that each test process reads.
- Security testing — identify which ports are commonly assigned to services (and therefore likely open) when planning network scans or firewall configurations.
- Infrastructure as Code — when provisioning cloud resources, use random ports for internal services to avoid predictable port assignments that could be targeted.
- Port conflict debugging — use Port Lookup to check whether a specific port is assigned to a known service, helping diagnose
EADDRINUSEerrors.
Privacy
All port generation runs entirely in your browser using the Web Crypto API. No data is sent to any server. Generated port numbers never leave your machine unless you copy or download them.