Localhost

  • Standard term

Localhost is the name a computer uses for itself. A link such as http://localhost:3000 points your browser at a program on the same machine, which is how builders preview a project before it goes live.

A request to localhost never goes out over the network, because the operating system hands it straight back to the same machine. The number after the colon is the port. Each program serving pages waits for requests on its own numbered port, so localhost:3000 and localhost:8080 can be two different apps on the same laptop.

Where you’ll meet it

A coworker posts in your team chat that the new sign-up page is ready, with the link http://localhost:3000. You click it and get "This site can't be reached." On their screen, the page loads fine.

What to do

Ask them for a preview link from their hosting service, a web address anyone on the team can open. Their coding agent can usually set one up. Until then, a shared screen in a quick call lets you see the page.

Easy to mix up

Does the app keep running when the laptop sleeps?
LocalhostDeployment
No, it stops along with the computerYes, a server keeps it up around the clock

Check yourself

You copy your shop's site, settings and all, to your laptop and run it on localhost to try a new newsletter design. You click "Send test newsletter." Where does it go?

Go deeperOther devices can open a local app, and browsers trust localhost more

The computer translates the name localhost into its loopback address, 127.0.0.1 or ::1. A development server can also accept requests at the machine's local network address, usually by listening on 0.0.0.0, shorthand for every network the machine is on, so phones and laptops on the same Wi-Fi can open it. Tunneling tools can go further and give it a public web address.

Browsers give http://localhost the trust they normally keep for HTTPS, the encrypted form of http, so features that require it, such as camera access, work there. A phone that opens the same page at the laptop's network address gets plain http without that trust, and a camera feature that works on the laptop may fail there. A deployed site served over HTTPS has the trust on every device.

Practice Build Basics

Or take the learning quiz on a mix of every set