Public vs private IP: what they are and how they differ
Your computer has one IP, your router another, and websites see a third. This guide explains why and how to tell which is which.
The difference in a nutshell
A public IP identifies your connection on the Internet: it is what the websites you visit see, and it is unique worldwide at that moment. Your provider assigns it to you.
A private IP is what your devices have inside your local network (192.168.1.34, for example). It only makes sense within that network: millions of homes use exactly the same private IPs without any conflict, because they never go out to the Internet as they are.
Private IP ranges
RFC 1918 reserves three blocks for private networks:
- 10.0.0.0/8: from 10.0.0.0 to 10.255.255.255 (16.7 million addresses). Common in companies.
- 172.16.0.0/12: from 172.16.0.0 to 172.31.255.255 (1 million addresses). Used, for example, by Docker and many corporate networks.
- 192.168.0.0/16: from 192.168.0.0 to 192.168.255.255 (65,536 addresses). The one almost every home router uses.
Other special ranges are not public either: 127.0.0.0/8 (loopback), 169.254.0.0/16 (link-local, when a device gets no IP from DHCP) and 100.64.0.0/10, which providers use for CGNAT.
How NAT works
Your router acts as a go-between. When your phone (192.168.1.34) requests a website, the router replaces the source address with its public IP and notes in a table who that connection belongs to. When the reply arrives, it checks the table and hands it to the phone. This is called NAT (network address translation).
Thanks to NAT, all the devices in a home go online with a single public IP, which has let IPv4 last decades longer than planned. As a side effect, nobody outside can start a connection to your devices unless you open a port on the router.
CGNAT: when not even your router has a public IP
Because of the IPv4 shortage, many providers (especially fiber and mobile) apply a second NAT in their own network: CGNAT. Your router gets an address from the 100.64.0.0/10 range instead of a public one, and the public IP is shared by several customers at once.
You notice it because you cannot open ports: home servers, cameras with remote access or some game consoles stop being reachable from outside. To find out, compare the WAN IP your router shows with the one in «What is my IP»: if they differ, you are behind CGNAT. Many providers take you out of it on request, sometimes for a fee, and with IPv6 the problem goes away.
How to see your public and private IP
- Public IP: open the «What is my IP» tool. It shows the address you go online with, your provider and your approximate location.
- Private IP on Windows: run ipconfig and look for «IPv4 Address».
- Private IP on macOS: System Settings > Network, or ipconfig getifaddr en0 in the terminal.
- Private IP on Linux: ip addr.
- On a phone: Settings > Wi-Fi > the connected network.
To find out whether a given address is public or private, enter it in the subnet calculator: the result shows the address type.
Frequently asked questions
Is it dangerous if someone knows my public IP?
Not very. It reveals your provider and an approximate location (usually the city or region), not your street address. An up-to-date router with its firewall on is enough protection.
Does my public IP change?
It depends on the provider. Many home connections have a dynamic IP that changes when the router restarts or every so often. If you need it not to change, you can get a static IP.
Can two devices have the same private IP?
On different networks, yes, and that is normal. On the same network, no: there is an IP conflict and one of them loses its connection.
Can a private IP be geolocated?
No. A private IP only exists inside its local network and has no public location. Only public IPs have geolocation and WHOIS data.