Localhost Ports Explained: 80, 8080, 3000, 5173, 4321, 4173
What is http://localhost:80, localhost:4173, localhost:4321, or localhost:8080? A port-by-port guide to common local services — Vite, Astro, Next.js, MongoDB, Redis, and more.
When you see http://localhost:PORT, localhost80, or localhost:4173 in a browser or terminal, it is usually not a public website — it is a process on your machine. This guide answers “what is listening on this port?” and lists common defaults.
Paste a full address into the localhost URL parser. For conflict troubleshooting, see localhost port conflicts.
One-minute lookup (high-traffic ports)
| Address you see | Typical meaning | Jump |
|---|---|---|
http://localhost / http://localhost:80 / localhost80 | Default HTTP (Apache, Nginx, IIS, Caddy) | #port-80 |
| http://localhost:4173 | Vite preview (vite preview) | #port-4173 |
| http://localhost:4321 | Astro dev server | #port-4321 |
| http://localhost:5173 | Vite dev server (most common) | #port-5173 |
| http://localhost:3000 | Next.js, NestJS, Express, CRA, Rails, … | #port-3000 |
| http://localhost:8080 | Tomcat, Spring Boot, alternate Apache | #port-8080 |
http://localhost:8081 / exp://localhost:8081 | Expo Metro Bundler | #port-8081 |
| http://localhost:8000 | Django, php -S, FastAPI/Uvicorn | #port-8000 |
mongodb://localhost:27017 | MongoDB | #port-27017 |
redis://localhost:6379 | Redis | #port-6379 |
localhost:80 / localhost80
Meaning: Default HTTP port. Visiting http://localhost uses 80; people also type localhost:80, localhost 80, or localhost80.
Common services: Apache (XAMPP/WAMP/LAMP), Nginx, IIS, Caddy, many PHP stacks.
Check who is listening:
# macOS / Linux
lsof -i :80If the page fails to load, the service may be stopped or the port occupied — see port conflicts. Also: Apache, Nginx, XAMPP.
localhost:4173 — Vite preview
Meaning: Default port for vite preview (production-build preview).
vs 5173:
| Port | Command | Use |
|---|---|---|
| 5173 | vite / npm run dev | Development (HMR) |
| 4173 | vite preview | Preview built assets |
After npm run build + vite preview, http://localhost:4173 is expected. See Vite on localhost.
localhost:4321 — Astro dev server
Meaning: Astro’s default astro dev port is 4321.
Opening http://localhost:4321 usually means an Astro app is running locally. See Astro.
localhost:5173 — Vite dev server
Meaning: The most common frontend dev port. Vite and many Vite-based tools default to 5173.
http://localhost:5173 ≈ npm run dev is up. See Vite, React + Vite.
localhost:3000
Meaning: Default web port for many Node stacks: Next.js, NestJS, Express, CRA, Rails, Bun, and more.
Multiple projects often fight over 3000 — change PORT or framework config. See Next.js, NestJS, port conflicts.
localhost:8080
Meaning: Popular alternate HTTP port: Tomcat, Spring Boot (configurable), a second local web server, or Apache moved off 80.
When you open http://localhost:8080, check whether it is Java or a reconfigured Apache/Nginx. See Tomcat, Spring Boot.
Note: queries like http://localhost::8080 (double colon) are typos — use a single colon: http://localhost:8080.
localhost:8081 and exp://localhost:8081
Meaning:
- Browser http://localhost:8081: often Expo Metro or another alternate web port
exp://localhost:8081: Expo / React Native client protocol (not a normal web page)
See Expo local debugging.
localhost:8000
Meaning: Common for Django, php -S localhost:8000, FastAPI (Uvicorn), some Deno apps.
php -S localhost:8000 -t publicDatabase and cache ports
mongodb://localhost:27017
MongoDB defaults to 27017. Connection strings look like:
mongodb://localhost:27017
mongodb://127.0.0.1:27017/mydbThis is a client URI (mongosh, Compass, drivers), not a browser page. See MongoDB locally.
redis://localhost:6379
Redis defaults to 6379:
redis://localhost:6379See Redis locally.
Other database ports
| Port | Service | Guide |
|---|---|---|
| 3306 | MySQL / MariaDB | MySQL, MariaDB |
| 5432 | PostgreSQL | PostgreSQL |
Web & frontend ports (full table)
| Port | Typical use | Example |
|---|---|---|
| 80 | Apache, Nginx, IIS default HTTP | http://localhost |
| 443 | HTTPS | https://localhost |
| 3000 | Next.js, Express, NestJS, CRA | http://localhost:3000 |
| 4173 | Vite preview (vite preview) | http://localhost:4173 |
| 4200 | Angular CLI (ng serve) | http://localhost:4200 |
| 4321 | Astro dev server | http://localhost:4321 |
| 5000 | Flask default | http://localhost:5000 |
| 5173 | Vite dev server | http://localhost:5173 |
| 8000 | Django, php -S, Uvicorn | http://localhost:8000 |
| 8080 | Tomcat, Spring Boot, alternate web | http://localhost:8080 |
| 8081 | Expo Metro, alternate web | http://localhost:8081 |
| 8888 | MAMP default, Jupyter, … | http://localhost:8888 |
Other common ports
| Port | Use |
|---|---|
| 1337 | Strapi default |
| 19000 | Expo Dev Tools |
| 54321 | Supabase local CLI (API gateway, …) |
| 9000 | PHP-FPM (FastCGI; usually not opened in a browser) |
How to see who owns a port
- macOS / Linux:
lsof -i :5173orss -tlnp | grep 5173 - Windows:
netstat -ano | findstr :5173
Freeing ports, changing binds, Docker conflicts: port-conflicts.
FAQ
Q: Difference between localhost:80 and localhost?
None for HTTP — omitting the port means 80.
Q: Why does localhost:4173 show up?
Usually Vite preview was started. Stop that process and the URL goes away.
Q: Port opens but the page is blank?
Service may not be running, may use another port, or may not bind to the interface you expect. Check with lsof / netstat.
Summary
Memorize the high-frequency set: 80 (default site), 5173 (Vite dev), 4173 (Vite preview), 4321 (Astro), 3000 (Node stacks), 8080 (Java / alternate web), 8000 (Django/PHP), 27017 (MongoDB), 6379 (Redis).