Localhost not working
Localhost problems usually come from one of four places: no running service, wrong port, wrong protocol, or wrong path.
Fast checklist
- 1 Check the exact URL, including protocol, hostname, port, and path.
- 2 Confirm the local server is running in your terminal or service manager.
- 3 Try the loopback IP version, such as http://127.0.0.1:3000/.
- 4 Check whether another process is already using the port.
- 5 Read the terminal error before changing firewall or browser settings.
Quick diagnostic checks
curl -I http://127.0.0.1:PORT/If the numeric loopback works but localhost fails, investigate hosts file, IPv6, bind address, or certificate configuration.
lsof -i :PORTThis separates a browser issue from a missing server or a port conflict. Replace PORT with 3000, 5173, 8000, or the value in your terminal.
http://localhost:PORT/pathMost localhost mistakes come from copying the wrong protocol, port, or path from a tutorial instead of the current project output.
Live request check
What this page sees
HTTP request headers
Sensitive headers such as cookies and authorization tokens are filtered before display.
Read the error type first
Connection refused, site cannot be reached, SSL protocol errors, and 404 pages point to different fixes. Do not treat them as the same problem.
Use the terminal as the source of truth
Most dev servers print the exact local URL. Copy that line instead of guessing the port from a tutorial.
Quick error map
Classify the browser message before changing code. That keeps you from editing firewall settings when the real issue is a stopped server or wrong path.
- ERR_CONNECTION_REFUSED: nothing accepted the connection on that host and port.
- 404 not found: a server answered, but the route is not mounted.
- SSL protocol error: the browser likely used https while the local service speaks http.
- Blank app shell: the frontend loaded, but data, environment variables, or an API may be failing.
Related localhost guides
Localhost refused to connect
Fix localhost refused to connect by checking the server process, URL, port, protocol, firewall, and local logs.
Comparisonlocalhost vs 127.0.0.1
Compare localhost and 127.0.0.1, understand loopback addresses, and learn when one works while the other fails.
Typo guideLocalhost Typo Fixer
Fix common localhost typos such as locallhost, localhos, lcoalhost, localhost.com, http localhost, and https localhost.
Developer toolLocalhost URL Builder
Build localhost URLs with the right protocol, host, port, and path, then compare localhost, 127.0.0.1, and LAN IP patterns.
FAQ
Why does localhost work in one project but not another?
Each project can use a different port, framework, path, or protocol. Check the terminal output for the active project.
Why does localhost.com not work like localhost?
localhost is a special local hostname. A public domain with a similar name is not the same thing as your computer loopback address.
Is refused to connect the same as a 404?
No. Refused to connect means nothing accepted the connection on that host and port. A 404 means a server answered, but the requested path was missing.
Should I change firewall settings first?
Usually no. First confirm the server process is running, the port is correct, and the protocol matches. Firewall issues are more common when another device tries to reach your machine.
How do I know whether the problem is the browser or the server?
Try the same URL with 127.0.0.1, check the terminal output, and use a command such as lsof -i :PORT. If no process is listening, the server side needs attention.