Home / Router / IP address types

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.

How addresses differ: a public IP on the internet, a private router address, private device addresses, and 127.0.0.1 for the device itself

Which one to use

  1. Running a project on your computer? Use localhost.
  2. Want your phone to open it? Use the computer’s address on your network. See open localhost from your phone.
  3. Want the router page? Use its gateway address. See the router IP finder.
  4. Want people on the internet to reach you? You need a public address or a tunnel.

Four kinds of address

AddressMeansWho can reach it
localhost or 127.0.0.1This device itselfOnly the device
192.168.x.x, 10.x.x.x, 172.16-31.x.xA device on your home networkDevices on the same network
Your public IPYour connection to the internetThe whole internet, if allowed
169.254.x.xNo address was givenNothing 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.

Last checked 2026-10-20. Sources: RFC 1918: private address ranges

Free tools that help

Related pages

Popular router login pages