Localhost
The name a computer uses to talk to itself.
Localhost is the name every computer uses to mean "this same machine". When a program connects to localhost, the message never goes out to the network: the operating system turns it around and delivers it right back, through a virtual connection called the loopback interface. Its usual address is 127.0.0.1 in IPv4 and ::1 in IPv6.
Developers use it all the time. When you build a website, you run it on your own laptop and open something like http://localhost:3000 in the browser. The 3000 is the port, which tells the computer which program should answer. Only you can see that site: nobody on the internet can reach your localhost, because for them, localhost is their own computer.
That is also a safety feature. A database or admin panel that only listens on localhost cannot be reached from outside. And it explains a classic confusion: "it works on my machine" sometimes means it works on localhost and nowhere else, because the real server is set up differently.
Keep in mind
- Localhost always means "this computer".
- Its address is
127.0.0.1(IPv4) or::1(IPv6). - Traffic to localhost never leaves the machine.
- Developers try out sites at addresses like
localhost:3000before putting them online.