EMZETT.
Login

Localhost

In short: localhost is the name for your own computer. The address is 127.0.0.1 (IPv4) or ::1 (IPv6).

In more detail: Requests to localhost never leave the computer. They go through the virtual “loopback” interface straight back to the same device. That is why localhost cannot be reached from outside.

In Depth

  • Development: web developers run their application locally and open it at http://localhost:3000 (the number after the colon is the port). This lets you test without putting anything on the internet.
  • Address range: the whole range 127.0.0.0/8 is loopback, usually only 127.0.0.1 is used.
  • hosts file: the mapping of “localhost” to 127.0.0.1 is in the system’s hosts file.
  • Checking: ping localhost shows whether the computer’s network stack works, see ping.
  • Distinction: 0.0.0.0 means “listen on all interfaces” for servers. Your own address on the network (e.g. 192.168.1.20) is something else than localhost and reachable from other devices.

See also: host, IP addresses, web server