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 seeTypical meaningJump
http://localhost / http://localhost:80 / localhost80Default HTTP (Apache, Nginx, IIS, Caddy)#port-80
http://localhost:4173Vite preview (vite preview)#port-4173
http://localhost:4321Astro dev server#port-4321
http://localhost:5173Vite dev server (most common)#port-5173
http://localhost:3000Next.js, NestJS, Express, CRA, Rails, …#port-3000
http://localhost:8080Tomcat, Spring Boot, alternate Apache#port-8080
http://localhost:8081 / exp://localhost:8081Expo Metro Bundler#port-8081
http://localhost:8000Django, php -S, FastAPI/Uvicorn#port-8000
mongodb://localhost:27017MongoDB#port-27017
redis://localhost:6379Redis#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 :80

If 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:

PortCommandUse
5173vite / npm run devDevelopment (HMR)
4173vite previewPreview 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:5173npm 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 public

See Django, FastAPI, PHP.


Database and cache ports

mongodb://localhost:27017

MongoDB defaults to 27017. Connection strings look like:

mongodb://localhost:27017
mongodb://127.0.0.1:27017/mydb

This is a client URI (mongosh, Compass, drivers), not a browser page. See MongoDB locally.

redis://localhost:6379

Redis defaults to 6379:

redis://localhost:6379

See Redis locally.

Other database ports

PortServiceGuide
3306MySQL / MariaDBMySQL, MariaDB
5432PostgreSQLPostgreSQL

Web & frontend ports (full table)

PortTypical useExample
80Apache, Nginx, IIS default HTTPhttp://localhost
443HTTPShttps://localhost
3000Next.js, Express, NestJS, CRAhttp://localhost:3000
4173Vite preview (vite preview)http://localhost:4173
4200Angular CLI (ng serve)http://localhost:4200
4321Astro dev serverhttp://localhost:4321
5000Flask defaulthttp://localhost:5000
5173Vite dev serverhttp://localhost:5173
8000Django, php -S, Uvicornhttp://localhost:8000
8080Tomcat, Spring Boot, alternate webhttp://localhost:8080
8081Expo Metro, alternate webhttp://localhost:8081
8888MAMP default, Jupyter, …http://localhost:8888

Other common ports

PortUse
1337Strapi default
19000Expo Dev Tools
54321Supabase local CLI (API gateway, …)
9000PHP-FPM (FastCGI; usually not opened in a browser)

How to see who owns a port

  • macOS / Linux: lsof -i :5173 or ss -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).

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run