Skip to main content
Back to Dev generators

Dev

Random Port & Service Generator

Used by developers, writers, and creators worldwide.

A random port and service generator removes the real friction of picking non-conflicting port numbers during local dev setup. Developers reach for it when spinning up microservices, Docker Compose stacks, or Kubernetes dev clusters and need a clean list of ports fast. Choose from well-known (0–1023), registered (1024–49151), or ephemeral (49152–65535) ranges, set how many you need, and pick an output format. The labeled format gives you readable port-service pairs for docs and diagrams. The env var format produces lines like PORT_REDIS=6379 ready to drop into a .env file. Results are deduplicated across every batch, so you can assign each port to exactly one service without manually scanning for collisions. No spreadsheet required.

Loading usage…

Free forever — no account required

How to use

  1. Choose your options above
  2. Click Generate
  3. Copy your result

Detailed instructions

  1. Set the 'How Many' field to the number of port assignments you need for your project.
  2. Choose a Port Range: well-known for protocol reference, registered for app services, or ephemeral for high-range assignments.
  3. Select your Output Format — labeled for readable docs and diagrams, or env-var format for direct use in .env files.
  4. Click Generate to produce a deduplicated list of port-service pairs from your chosen range.
  5. Copy the output and paste it into your config file, diagram tool, or teaching material.

Use Cases

  • Generating PORT_ env vars for a Node.js microservices stack before writing any config files
  • Assigning unique host-side ports across services in a docker-compose.yml to prevent bind conflicts
  • Creating labeled port-to-service maps for network architecture diagrams in Figma or Lucidchart
  • Producing realistic port assignments for firewall rule exercises in a networking or DevOps course
  • Allocating ports across 8+ services in a local Kubernetes cluster using Minikube or kind

Tips

  • Use the registered range with env-var output when scaffolding a new docker-compose.yml — paste results straight into the ports section.
  • Generate well-known ports when building a networking lesson; the labeled format shows students which services live at which canonical ports.
  • If a generated port conflicts with one already in use, regenerate the full set rather than swapping one port manually — you may introduce a new conflict.
  • Cross-check generated ports against your machine's bound ports with 'lsof -i -P -n | grep LISTEN' on macOS/Linux before committing them to config.
  • For microservice projects, generate a larger batch than you need (e.g. 12 for 8 services) and keep the spares as documented reserves for future components.
  • Ephemeral range ports work well for short-lived test servers in CI pipelines where port persistence across runs is not required.

FAQ

what's the difference between well-known, registered, and ephemeral ports

Well-known ports (0–1023) are reserved by IANA for core protocols like HTTP (80) and SSH (22) and require root to bind. Registered ports (1024–49151) cover named apps like MySQL (3306) and Postgres (5432) and are the safest range for dev servers. Ephemeral ports (49152–65535) are OS-assigned for outbound connections and should not be used for long-lived services.

can two docker containers use the same host port at the same time

No — only one process can bind a given TCP or UDP port on a host interface at a time. A second container mapping to the same host port will fail to start with an address already in use error. Generate a unique batch here, assign one port per container, and paste them straight into your docker-compose.yml.

what does the env var output format look like and how do I use it

The env format produces lines like PORT_NGINX=8080 or PORT_REDIS=6379, ready to paste into a .env file or a shell export block. This skips the manual reformat step when moving from a port list to actual config files, which matters most when wiring up five or more services at once.