Skip to content

What is localhost? 127.0.0.1, explained

localhost is your machine's name for itself: it resolves to 127.0.0.1, the loopback address, and anything sent there is delivered inside the operating system without ever touching a cable, a router, or the internet. It's the address where dev servers live, the safest place a service can listen, and the source of the classic confusion — "works on localhost, unreachable from my phone" — that this guide untangles with one mental model: three addresses, three scopes.

Maintained by the ipconfig.io team · Reviewed 1 July 2026

Three addresses, three scopes

Every machine you use sits behind all three at once:

AddressScopeWho can reach it
127.0.0.1 / localhostThis machineOnly processes on the same machine
192.168.1.23 (private/LAN)Your networkDevices on the same LAN
203.0.113.42 (public — curl ipconfig.io)The internetAnyone, as far as NAT and firewalls allow

Loopback is genuinely internal: packets to 127.0.0.1 (technically the whole 127.0.0.0/8 block, plus ::1 on IPv6) are turned around inside the kernel's network stack. No driver, no wire, no eavesdropper on the Wi-Fi — which is both why it's fast and why it's the default home of things that should never be exposed: dev servers, local databases, admin panels.

The classic confusion, resolved

You start a dev server, it prints http://localhost:3000, it works — and your phone can't open it. Nothing is broken; the server is bound to loopback, and loopback means same machine only. The bind address decides the audience:

  • 127.0.0.1:3000 — private to the machine. Right default for anything unfinished or sensitive.
  • 0.0.0.0:3000 — listen on every interface: loopback and LAN. Now http://192.168.1.23:3000 works from your phone — and from anyone on the network, so treat it as a deliberate act, not a convenience flag. (0.0.0.0 is a server-side wildcard, not a place you browse to.)

Check what's actually listening where with ss -ltn (Linux) or netstat -an — the local-address column tells you each service's audience at a glance. And the internet is a third, separate step beyond LAN exposure: reaching a home service from outside additionally means NAT port forwarding or, better, a tunnel — 0.0.0.0 alone never did that.

One more resident of the neighborhood: localhost is where tools like SSH tunnels and containers do their business — ssh -L 8080:… delivers a remote service to your 127.0.0.1:8080, and Docker's port mappings (-p 8080:80) publish a container onto the addresses above, with the same loopback-vs-everything choice (-p 127.0.0.1:8080:80 for machine-only).

Frequently asked questions

What is localhost? Your machine's own address — 127.0.0.1/::1 — handled entirely in the OS, never on the network.

localhost vs my IP? Scopes: 127.0.0.1 = self only; 192.168.x.x = your LAN; the curl ipconfig.io answer = the world.

Why can't my phone open my localhost server? The server is bound to loopback. Bind 0.0.0.0 and use the machine's LAN address — knowingly widening the audience.

What's 0.0.0.0? A listen-everywhere wildcard for servers, not a destination.

Next steps

Geolocation by MaxMind GeoLite2. No tracking, no keys.