localhost:3000 — what runs on port 3000 and how to fix it

localhost:3000 is port 3000 on your own computer, and it's the default development port for React, Next.js, Nuxt, Ruby on Rails and Grafana. When you open http://localhost:3000, the browser connects to whatever process on this machine is listening on port 3000. If you see "This site can't be reached" or ERR_CONNECTION_REFUSED, nothing is listening there right now.

What runs on port 3000

ToolDefault on 3000?Start command
Next.jsYesnpm run dev (next dev)
React (Create React App)Yesnpm start
NuxtYesnpm run dev (nuxt dev)
Ruby on RailsYesbin/rails server
Express / Node.jsBy conventionnode server.js (app.listen(3000))
GrafanaYesgrafana server or Docker -p 3000:3000
GiteaYesgitea web

Vite-based React and Vue projects use localhost:5173 instead, and Angular uses localhost:4200.

Fix "localhost:3000 refused to connect"

  1. Check the server is actually running. Look at the terminal where you ran npm run dev. If the process exited, the error above the prompt tells you why: a missing dependency, a syntax error or a bad env var.
  2. Check the port it really chose. If 3000 was busy, Next.js and many other dev servers silently move to 3001, 3002 and so on. The terminal prints the real URL (Local: http://localhost:3001).
  3. Try 127.0.0.1 instead of localhost. Some Node versions bind only to IPv6 ::1, or only to IPv4. If one name works and the other doesn't, start the server with an explicit host (--host 127.0.0.1 or HOST=0.0.0.0).
  4. Inside Docker? The app must listen on 0.0.0.0 inside the container, and you need -p 3000:3000 to publish the port to your host.

Find and free a busy port 3000

Error: listen EADDRINUSE: address already in use :::3000 means another process already owns the port.

# macOS / Linux: who is on port 3000?
lsof -i :3000
# kill it
kill -9 $(lsof -ti :3000)
# Windows
netstat -ano | findstr :3000
taskkill /PID <pid> /F

Or leave the old process running and move the new one: PORT=3001 npm start, next dev -p 3001, nuxt dev --port 3001, rails server -p 3001.

Open localhost:3000 from another device

localhost only ever points at the machine you're typing on, so your phone can't open your localhost:3000. On the same network:

  1. Start the server on all interfaces: next dev -H 0.0.0.0, HOST=0.0.0.0 npm start or rails server -b 0.0.0.0.
  2. Find your LAN IP (ipconfig getifaddr en0 on macOS, hostname -I on Linux, ipconfig on Windows).
  3. Open http://192.168.x.x:3000 on the other device. Allow the port through your OS firewall if it's blocked.

Share localhost:3000 publicly

To let a client, a teammate or a mobile device on another network see the app, put a tunnel in front of the port. A tunnel needs no router changes or public IP:

relay connect --name my-app http://localhost:3000

The relay CLI opens an outbound connection and prints a public HTTPS URL that forwards to port 3000. Keep the same --name and the URL stays the same across restarts, which matters for OAuth redirect URIs and anything else you've configured with that URL.

If you need webhooks (Stripe, GitHub, Shopify) to reach a handler on port 3000, use relay forward instead:

relay forward --bucket my-app http://localhost:3000/webhooks

Every webhook sent to the bucket's public URL is delivered to your local handler and logged, so you can inspect it and replay it. See receive webhooks on localhost for the full setup.

Frequently asked questions

What is localhost:3000?

localhost:3000 is port 3000 on your own machine. It is the default development port for React (Create React App), Next.js, Nuxt, Ruby on Rails and Grafana, and the port most Express and Node.js tutorials use. Opening http://localhost:3000 in a browser connects to whatever process is listening on that port.

Why does localhost:3000 say refused to connect?

Nothing is listening on port 3000. Either the dev server isn't running, it crashed on startup, or it started on a different port (Next.js and Vite pick the next free port if 3000 is busy). Check the terminal where you ran npm run dev for the actual URL and any errors.

How do I kill the process using port 3000?

On macOS or Linux run lsof -i :3000 to find the PID, then kill it with kill -9 PID, or do both at once with kill -9 $(lsof -ti :3000). On Windows run netstat -ano | findstr :3000 to get the PID, then taskkill /PID <pid> /F.

How do I open localhost:3000 from my phone or another computer?

Make the dev server listen on all interfaces (for example next dev -H 0.0.0.0 or HOST=0.0.0.0 npm start), then open http://YOUR-LAN-IP:3000 from a device on the same Wi-Fi. To reach it from outside your network, use a tunnel such as relay connect, which gives the port a public HTTPS URL.

How do I change the port from 3000?

Set the PORT environment variable (PORT=3001 npm start for Create React App and Express apps that read process.env.PORT), or pass a flag: next dev -p 3001, nuxt dev --port 3001, rails server -p 3001.