127.0.0.1 Localhost: What It Is & Why You See It

127.0.0.1 is localhost, the address that always points back to your own device. Here is what it does and why it is not your router.

127.0.0.1 is the loopback address, also called localhost. Any data sent to it never leaves your computer: it loops straight back to the same device.

127.0.0.1 is localhost, the loopback address that always points back to your own computer. Data sent to it never leaves your device, it is not your router login, and it is not reachable from other devices.

It is not your router login, and it is not reachable from other devices. Developers use it constantly to test websites and apps locally.

What localhost is used for

  • Web development: running a site at http://localhost:3000 or 127.0.0.1:8080 before publishing.
  • Databases and services: MySQL, Redis and others listen on 127.0.0.1 so only the same machine can reach them.
  • Testing networks: ping 127.0.0.1 checks that the network stack works.
  • Blocking sites: the hosts file can point unwanted domains to 127.0.0.1.

I reach for localhost first whenever I want to test something without touching the live site.

Loopback facts

ItemValue
IPv4 loopback127.0.0.1 (whole 127.0.0.0/8 range)
IPv6 loopback::1
Namelocalhost
Reachable from other devicesNo
Router loginNo, use your default gateway

I keep this table in mind when a tutorial mentions an address I do not recognize.

Common localhost errors

  • “localhost refused to connect”: no program is running on that port. Start your local server.
  • Port already in use: another app uses the port. Stop it or use another port.
  • Works on PC, not on phone: localhost on the phone means the phone itself. Use the PC private IP, like 192.168.1.25, instead.
  • Looking for router settings: use your default gateway, such as 192.168.1.1.

I check the port first, since a refused connection usually means nothing is listening there.

127.0.0.1 vs 0.0.0.0

127.0.0.1 means only this computer. 0.0.0.0, when a server listens on it, means all network interfaces, so other devices on the network can connect too. I think of 0.0.0.0 as the open door and 127.0.0.1 as the locked one.

Using localhost as a beginner

If you’re learning web development or setting up self-hosted tools, you’ll use localhost constantly. When you run a local server, the software tells you an address like http://localhost:3000 or http://127.0.0.1:8080. Only your own computer can open it.

Other people on your WiFi can’t reach localhost on your machine. To share a local project with a phone on the same WiFi, use your computer’s LAN IP (like 192.168.1.20) and make sure the server listens on 0.0.0.0, not just 127.0.0.1.

I start every new project on localhost, since a mistake there costs me nothing.

The hosts file and localhost

Your computer maps the name “localhost” to 127.0.0.1 in a small file called hosts. Some people also use the hosts file to block websites by pointing them at 127.0.0.1. If localhost stops working, check that file hasn’t been edited.

  • Windows: C:WindowsSystem32driversetchosts
  • Mac and Linux: /etc/hosts

I leave the hosts file alone unless I have a reason to change it, since a stray edit breaks localhost.

Ports: the number after localhost

When you see an address like localhost:3000, the number after the colon is the port. One computer can run many services at once, each listening on its own port. Some common ones you’ll meet:

  • 80 and 443: normal websites (HTTP and HTTPS).
  • 3000, 5173, 8080: development servers for web projects.
  • 3306: MySQL databases.
  • 5432: PostgreSQL databases.
  • 8123: Home Assistant.

If two programs try to use the same port, the second one fails with an “address already in use” error. Stop the first program or change the port. I memorized the common ports by the services I use, not by the numbers themselves.

When localhost suddenly stops working

  • Make sure the server or app is actually running.
  • Try 127.0.0.1 instead of localhost, in case the name resolves to IPv6 (::1) and the app only listens on IPv4.
  • Check your hosts file still maps localhost to 127.0.0.1.
  • Temporarily disable VPN or security software that may intercept local traffic.
  • Restart the computer if a crashed process is still holding the port.

I start at the top of this list, since the fix is usually the simplest one there.

Is 127.0.0.1 the only loopback address?

Not quite. The whole range 127.0.0.0 to 127.255.255.255 is reserved for loopback, so 127.0.0.2 or 127.1.2.3 also point back to your own machine. Developers sometimes use different 127 addresses to run several local services side by side. In IPv6, the loopback address is ::1, which is what “localhost” often resolves to first on modern systems.

In my own notes, I use 127.0.0.1 and leave the rest of the range alone.

FAQs About 127.0.0.1 and Localhost Explained

It’s the loopback address that always points to your own device, also called localhost.

No. Localhost only works on your own computer.

Nothing is running on that port, or a firewall is blocking it.

No. Your router is a separate device, usually at 192.168.x.1.

Localhost means only this device. Servers listening on 0.0.0.0 accept connections from any network interface.

The team behind this guide
Kevin Doyle

Kevin Doyle found this topic
SEO Research Lead
Focus: Topic & Keyword Research

Megan Taylor

Megan Taylor wrote this guide
Router Login & Setup · Published October 25, 2026
Focus: Buying Guides

Nina Petrova

Nina Petrova designed the visuals
Graphic Designer
Focus: Brand & Illustrations

Awais

Awais verified the facts
Founder & Editor-in-Chief · Last verified: November 2026
Focus: Final fact-check & publishing

Similar Posts