layman/terms
How code gets made

Localhost

loh · kul · hohst

In shortYour own computer, acting as a website's home while you build it, so only you can see it.

Before a website goes live, developers run it on their own computer to try it out. That private address is localhost.

Before opening night, actors rehearse. Sometimes that’s in a living room, with cushions for an audience. Nobody else is watching, so mistakes don’t matter.

Localhost is that living room. It’s your own computer pretending to be a website’s home, so you can try the site before anyone else can see it. The address usually looks like localhost:4321.

Why it’s useful

What the number means

The number after the colon is called a port: like a door number on your computer. One computer can run several things at once, each at its own door.

What it isn’t

It isn’t on the internet. Nobody else can visit your localhost. To share it, you need to deploy it somewhere public.

Where the comparison breaks down

A rehearsal can feel very different from opening night. Websites too: something that works on localhost can still break on the real server, which is why teams test again on staging.

How the words fit together

You start localhost from the CLI. Next comes staging, then production, once you deploy.

Good to know

If someone sends you a link starting with localhost, it won't work for you. It only points to their own computer.

When you'll hear it

“It works on localhost.” It runs fine on my own computer, but it isn't live yet.

“Open localhost 3000.” Go to the address of the website running on your computer, at door number 3000.

“It works on my machine.” A classic excuse: it runs for me, so the problem must be somewhere else.

Say it in a meeting

“Has this been tried anywhere besides the developer's own computer?”

Try it yourselfReady to use it? The exact commands are on my other site, devcmds: Run a local web server ↗