What is localhost?
Your computer as a server
⏱ Est. ~4 min
01 · Read
You've been visiting localhost:3000 in your browser, but what does that actually mean?
localhost is a special hostname that always means "this computer". Every computer knows that localhost refers to itself. Behind the scenes, it maps to the IP address 127.0.0.1 — a special address that loops right back to your own machine.
Think of it like dialing your own phone number. The call doesn't go anywhere else — it comes right back to you.
The :3000 part is the port number. A single computer can run many servers at once, and the port number tells the browser which one to talk to.
💡 Picture thisIf your computer's IP address is like a building's street address, the port number is like the apartment number. The mail carrier (your browser) needs both to deliver the request to the right place. Port 3000 is apartment 3000 in the localhost building.
Key points
- localhost = this computer (IP address 127.0.0.1)
- Port numbers distinguish different servers on the same machine
- Common ports: 80 (HTTP), 443 (HTTPS), 3000 (dev servers)
- Only you can visit localhost — nobody else on the internet can see it
02 · Quiz
What does localhost:3000 mean?
- A website on the internet
- Google's server
- Port 3000 of any computer
- Your computer, port 3000
03 · Fill in the blank
localhost is another name for your own _____.
04 · Read
Important thing to understand: your server is currently private. Only browsers running on your computer can connect to it. Sending a friend the URL http://localhost:3000 won't work — their browser will look for a server on port 3000 on their computer, and they don't have one running.
This is actually good. It means you can build, experiment, and break things without anyone seeing your work. Your dev server is your private workshop.
In Level 10 you'll learn how to deploy a server to the internet so anyone in the world can visit. But for now, localhost is your safe learning space.
05 · Quiz
While your server is running, you send the URL http://localhost:3000 to a friend. What happens when they open it?
- Their browser looks for a server on their computer at port 3000 — probably won't find one
- They see your server's response, because it's on the internet
- It redirects to 127.0.0.1, which works for everyone
- They see a cached version of your page
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.