"Localhost" is the default hostname that refers to the local computer that a program is running on. It uses the IP address of 127.0.0.1 — also known as a "loopback" address because it routes information sent to it back to the local machine. Developers use "localhost" to test websites and software by pointing their web browser to the local computer instead of a remote server.
The localhost IP address 127.0.0.1 is a special address that is never assigned to any device by a network's router; it always points to the current device whenever requested. The name "localhost" is also reserved as a top-level domain name, not assignable by domain registrars, which prevents websites from hijacking and spoofing a local connection.
"Localhost" is used by developers testing websites and applications to fake a connection to another server. For example, if you are running web server software on a computer while building a website, you can point your web browser to "localhost" to view the in-progress site. The connection does not need to travel over a network, but the browser treats it like any other domain name.