Home / Localhost / Refused to connect

localhost Refused to Connect: How to Fix ERR_CONNECTION_REFUSED

Work through this checklist in order. Most cases are a server that is not running or the wrong port.

A browser showing the error: this site can’t be reached, ERR_CONNECTION_REFUSED

"localhost refused to connect" means your browser reached your computer, but no program was listening on that port. Follow the checks below in order. Most cases are fixed by the first or second one.

Checks to try, in this order

  1. Is the server running? Look at the terminal where you started it. If it stopped or you closed it, start it again.
  2. Is it the right port? The terminal usually prints the address, such as http://localhost:5173. Use exactly that.
  3. Use http, not https, unless you set up a certificate.
  4. Try 127.0.0.1 instead of localhost. Some systems send localhost to IPv6 while the server listens only on IPv4, or the other way round.
  5. Check that something listens on the port. Use the tool below.
  6. Docker? The container needs a port mapping like -p 8080:80, and the app inside must listen on 0.0.0.0, not only 127.0.0.1.
  7. Still nothing? Turn off a VPN or proxy for a moment, and check your firewall.

Find what is using port 3000

Run these in a terminal on your computer. Nothing is sent to this site.

Related problems and fixes

Works in one browser but not another
Clear that browser’s cache for localhost, and check for a proxy or extension.
Only fails on another device
localhost always means the device you are on. See how to open localhost from your phone.

Questions about Refused to connect

What does "localhost refused to connect" mean?
Your browser reached your computer, but nothing was listening on that port. The server is stopped, or the port is wrong.
Is localhost refused to connect a firewall problem?
Rarely. It is usually a stopped server or a wrong port. A firewall more often causes timeouts than refusals.

Updated 2026-10-02

Free tools that help

Config generators for this

Related pages