Localhost vs 127.0.0.1 vs 192.168.x.x vs Public IP
Plain explanation of localhost, 127.0.0.1, your local network address and your public IP, and which one to use for what.
Four kinds of address cause most confusion. They differ in who can reach them.
Which one to use
- Running a project on your computer? Use localhost.
- Want your phone to open it? Use the computer’s address on your network. See open localhost from your phone.
- Want the router page? Use its gateway address. See the router IP finder.
- Want people on the internet to reach you? You need a public address or a tunnel.
Four kinds of address
| Address | Means | Who can reach it |
|---|---|---|
| localhost or 127.0.0.1 | This device itself | Only the device |
| 192.168.x.x, 10.x.x.x, 172.16-31.x.x | A device on your home network | Devices on the same network |
| Your public IP | Your connection to the internet | The whole internet, if allowed |
| 169.254.x.x | No address was given | Nothing useful |
Common surprises
- My router address starts with 169.254
- That is a self-assigned link-local address. Your device could not get an address from the router. Reconnect to the network or restart the router.
- The IP I see online is different from the one on my device
- Your device has a private address. Websites see the public address of your router. They are different on purpose.
Questions people ask about IP address types
- Is localhost the same as 127.0.0.1?
- Yes in practice. localhost is the name and 127.0.0.1 is the IPv4 address it points to.
- Is my router 127.0.0.1?
- No. Your router has a private network address, such as 192.168.1.1.
Free tools that help
Related pages
- Find your router IP
- Login not working
- Forgot password and reset
- Change Wi-Fi password
- Default IP list
- Security checklist