ERR_CONNECTION_REFUSED: What It Means and How to Fix It

Key Takeaways
- ✓The browser reached the address and the connection was rejected.
- ✓Test on another network to see whether the cause is yours or the server's.
- ✓On localhost it nearly always means nothing is listening on that port.
- ✓On your own server: check the web server, listening ports, firewall and DNS.
Table of Contents
- •ERR_CONNECTION_REFUSED: What It Means and How to Fix It
- •ERR_CONNECTION_REFUSED: What It Means and How to Fix It
- •What the Error Looks Like
- •First, Find Out Where the Problem Is
- •If the Problem Is on Your Side
- •Localhost Refused to Connect
- •If It Is Your Website or Server
- •ERR_CONNECTION_REFUSED vs Similar Errors
- •Frequently Asked Questions
ERR_CONNECTION_REFUSED: What It Means and How to Fix It
ERR_CONNECTION_REFUSED is a Chrome error (Edge and other Chromium browsers show it too) that appears with the message "This site can't be reached" and "refused to connect". It means your browser found the server's address and tried to connect, and the connection was rejected: nothing is accepting connections on that address and port, or a firewall turned the request away.
ERR_CONNECTION_REFUSED: What It Means and How to Fix It
The cause can be on your device, on your network or on the server. The quickest way to tell is to open the site on another device and another network. This guide covers all three cases, plus the common localhost refused to connect case for developers.
What the Error Looks Like
Chrome and Edge:
This site can't be reached. example.com refused to connect. ERR_CONNECTION_REFUSEDFirefox:
Unable to connectSafari:
Safari can't connect to the serverCommand line:
curl: (7) Failed to connect ... Connection refused
First, Find Out Where the Problem Is
| Test | Result | Meaning |
|---|---|---|
| Open the site on mobile data | It loads | The problem is your device or your network |
| Open the site on mobile data | Same error | The problem is the website's server |
| Open other websites on the same device | They fail too | Your connection, proxy, VPN or security software |
If the Problem Is on Your Side
Reload and check the address. A wrong port in the URL, such as
:8080, gives this error at once.Restart your router and reconnect.
Turn off your VPN or proxy. On Windows, open Settings, Network and Internet, Proxy, and switch off any manual proxy you did not set.
Clear the browser cache or try a private window. If the private window works, turn off extensions one at a time.
Flush the DNS cache. On Windows run
ipconfig /flushdns. On macOS runsudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder. An old cached address can point at a server that no longer hosts the site.Pause your antivirus or firewall briefly to test, then turn it back on and add an exception if that was the cause.
Change DNS servers to a public resolver such as 1.1.1.1 or 8.8.8.8 if your provider's DNS returns a stale address.
Localhost Refused to Connect
On localhost or 127.0.0.1, this error almost always means no program is listening on the port you opened.
Check that your server is running. Look at the terminal where you started it; it may have crashed on startup.
Check the port. The app prints the port it listens on. Opening
localhost:3000when it listens on 5173 gives this error.List what is listening. On Linux and macOS:
lsof -i :3000. On Windows:netstat -ano | findstr :3000.Check the bind address. An app inside Docker, WSL or a virtual machine has to listen on
0.0.0.0, and the port has to be published, or the host can't reach it. See docker logs to read the container's startup output.Use http, not https, unless your local server has a certificate set up.
If It Is Your Website or Server
When everyone gets the error, the server is refusing connections on port 80 or 443. Connect over SSH and check these in order:
Is the web server running?
systemctl status nginxorsystemctl status apache2. If it failed to start, test the config withsudo nginx -t; see common Nginx errors for startup failures.Is it listening on the right ports?
sudo ss -tlnplists listening ports. You should see 80 and 443 on0.0.0.0or[::], not only on127.0.0.1.Is the firewall open? On Ubuntu,
sudo ufw statusshould allow 80 and 443. Cloud providers also have their own firewall or security group in the control panel. Our guide to opening ports on a VPS covers both layers.Does DNS point at the right server?
dig +short yourdomain.comshould return your server's current IP address. After a migration, an old record sends visitors to a server that no longer answers.Is HTTPS set up? If the site loads on
http://and is refused onhttps://, nothing listens on port 443. Install a certificate and add the HTTPS server block.
ERR_CONNECTION_REFUSED vs Similar Errors
| Error | Meaning |
|---|---|
| ERR_CONNECTION_REFUSED | The server's address answered and rejected the connection |
| ERR_CONNECTION_TIMED_OUT | No answer at all; often a firewall silently dropping the request or a server that is off |
| ERR_CONNECTION_RESET | The connection started and was cut off partway |
| DNS_PROBE_FINISHED_NXDOMAIN | The domain name could not be found, so no connection was tried (see our guide) |
Frequently Asked Questions
Is ERR_CONNECTION_REFUSED a problem with my computer or the website?
It can be either. If the site opens on another network or device, the cause is on your side. If it fails everywhere, the website's server is refusing connections.
Why does localhost refuse to connect?
No program is listening on that port. Start your development server, check the port number it prints, and open exactly that address.
Can a firewall cause ERR_CONNECTION_REFUSED?
Yes. A firewall on your device, on your network or on the server can reject the connection. Firewalls that drop requests without replying cause a timeout instead.
How do I fix ERR_CONNECTION_REFUSED on Android?
Switch between Wi-Fi and mobile data, turn off any VPN or private DNS setting, clear Chrome's cache in the app settings, and restart the phone.
Unsure Which Cloud Hosting Plan Fits Your Site?
Answer 4 quick diagnostic questions to estimate the server CPU, RAM and storage you need with transparent pricing.
Cloud Infrastructure Engineer.
Related Posts
DevOps & TutorialsDocker Port Mapping Explained: -p, EXPOSE and Compose ports
How Docker port mapping works: the -p syntax, EXPOSE vs publishing, Compose ports, service names on the network, and the UFW security detail most guides skip.
DevOps & TutorialsDocker Engine vs Docker Desktop: Which One Do You Need?
Docker Engine is the open-source runtime for Linux; Docker Desktop is a desktop app with a VM, GUI and its own licence. Which to use on servers and laptops.
DevOps & Tutorialsdocker compose up --build Explained (With Examples)
docker compose up --build builds images before starting containers. When you need it, when you don't, and the related flags people confuse, with examples.