127.0.0.1
The loopback address. Whatever computer you type it on, 127.0.0.1 means that same computer, and traffic sent to it never reaches the network.
Updated November 2026 · 3 min read
-
Written by
Andrian Valeanu
Founder of Pulsetic
-
Reviewed by
Ionut Caval
Technical reviewer
The short version: 127.0.0.1 is the IPv4 loopback address: it always points at the computer you are using. localhost is the name for it. Opening http://127.0.0.1:8000 reaches a program on your own machine listening on port 8000, and if no program is listening there, the connection is refused.
- Name
- IPv4 loopback address
- Hostname
localhost- IPv6 equivalent
::1- Reserved range
127.0.0.0/8, every address that starts with 127
What is 127.0.0.1?
127.0.0.1 is an address every computer gives to itself. The operating system handles traffic sent to it internally: nothing goes out through Wi-Fi or a network cable, so it works with no internet connection at all. Engineers call it the loopback address, because a request sent there loops straight back.
The whole block from 127.0.0.0 to 127.255.255.255 is reserved for this, though in practice almost everything uses 127.0.0.1. IPv6 has a single loopback address, ::1.
localhost is the name that points to these addresses. The mapping lives in your hosts file (/etc/hosts on macOS and Linux, C:\Windows\System32\drivers\etc\hosts on Windows), and modern systems resolve it to loopback even without that file.
127.0.0.1, localhost, 0.0.0.0 and your network IP
Four addresses that get mixed up. The difference matters most when you decide what a server should listen on.
| Address | What it means | Who can connect |
|---|---|---|
127.0.0.1 | This computer, over IPv4 | Only programs on this computer |
localhost | A name for loopback: 127.0.0.1, ::1 or both | Only programs on this computer |
::1 | This computer, over IPv6 | Only programs on this computer |
0.0.0.0 | When a server listens on it: every network interface at once. It is not an address to browse to | Anyone who can reach the computer, if the firewall allows |
192.168.x.x or 10.x.x.x | This computer's address on your local network | Devices on the same network |
Why 127.0.0.1 refuses to connect
- Nothing is listening on that port. The address always exists, so the only question is whether a program has the port open. If none does, you get "127.0.0.1 refused to connect".
- No port in the address.
http://127.0.0.1means port 80. A dev server on 3000 or 8000 needs the port typed out:http://127.0.0.1:8000. - The server listens on IPv6 only. A program bound to
::1does not answer on127.0.0.1. Tryhttp://localhost:PORTorhttp://[::1]:PORT. - The server is inside a container or virtual machine. There,
127.0.0.1means the container itself, not your computer. The app has to listen on0.0.0.0and the port has to be published. - You expected another machine. A link to
127.0.0.1that somebody sent you opens your own computer, never theirs. - You typed https. A local server without a certificate answers only
http://.
Check whether anything is listening
One command shows whether a program is listening on the port, and which one. No output means nothing is listening, and that is exactly when the browser says the connection was refused. The examples use port 3000: put your own port in its place.
On Linux, ss -ltnp | grep :3000 gives the same answer. Add sudo on macOS or Linux to see programs owned by another user. Stopping a process ends whatever it was doing, so check what it is before you stop it.
How to fix it
If 127.0.0.1 refuses to connect
- Start the program you expect to answer, and read the address and port it prints.
- Open that exact address, port included, with
http://. - Confirm something is listening with the commands in the section above.
- If the server is in Docker, publish the port and make the app listen on
0.0.0.0inside the container.
If you want other devices to reach your server
- Make the server listen on
0.0.0.0, not127.0.0.1. Most dev servers have a--hostoption for this. - Find your computer's network address:
ipconfigon Windows,ipconfig getifaddr en0on a Mac,ip addron Linux. - On the other device, open
http://THAT-ADDRESS:PORTwhile both are on the same network. - Allow the port in your firewall if the connection times out.
From localhost to production
A service that listens on 127.0.0.1 in production is deliberately private: a database or an application server that only the web server on the same machine should reach. That is good practice, and it also means nothing outside the machine can test it directly. From the outside you see only the public address, and whether it answers.
To test a deployed address by hand, the free bulk URL status checker shows the status code and redirects for a list of URLs, and Is Website Down checks one from several countries. Neither can see localhost: like any service on the internet, they only reach public addresses.
Deployed it? Watch the public URL.
Pulsetic is website uptime monitoring. It cannot reach localhost, but once your app is live it checks the public URL from outside your network, confirms any failure from another region, then emails you.
10 monitors free, checked every 5 minutes, with email alerts on failure and recovery. No credit card.
Sources and further reading
The documentation and specifications this guide is written from.
Frequently asked questions
-
What is 127.0.0.1?
It is the IPv4 loopback address. On any computer it refers to that same computer, so it is used to reach programs running locally.
-
Is 127.0.0.1 the same as localhost?
Nearly.
localhostis a name and127.0.0.1is the address it usually resolves to. On many systems localhost also resolves to the IPv6 address::1, so a server that listens on only one of them can answer one form and refuse the other. -
What is the difference between 127.0.0.1 and 0.0.0.0?
A server listening on
127.0.0.1accepts connections only from the same computer. A server listening on0.0.0.0accepts them on every network interface, so other devices can connect too. -
Can someone hack me through 127.0.0.1?
Not from outside: no other computer can send traffic to your loopback address. A program already running on your computer can connect to it, so services that listen there still deserve a password if they hold anything sensitive.
-
Know when your live website stops answering.
2-minute setup · Cancel any time
-
No credit card needed