Your public IP address is the address the rest of the internet sees when your connection reaches out. The fastest way to find it is a single command: on Linux or macOS run curl https://api.getpublicip.com/ip; on Windows run Invoke-RestMethod ip.getpublicip.com in PowerShell, or open any what-is-my-IP page in a browser. Either returns your current public IPv4 (or IPv6) in about a second.
This hub covers how to find your public IP on every platform, how it differs from the private IP your device reports locally, and how to tell whether your IP is dynamic or hidden behind CGNAT. For step-by-step command references, see the Linux guide, the Windows guide and the Mac guide.
Public IP vs private (local) IP
Every device on your network has a private IP: typically 192.168.x.x, 10.x.x.x, or 172.16.x.x–172.31.x.x. These are reusable inside local networks and are not reachable from the internet. Your router translates between them and a single public IP using NAT.
This is why ipconfig (Windows), ip addr (Linux) or ifconfig (macOS) shows an address like 192.168.1.42 rather than your real public IP; those commands report the local address. To see the public one, you have to ask a server on the internet what address your traffic arrived from.
Find your public IP on any platform
- Linux:
curl https://api.getpublicip.com/ip,curl ifconfig.me, ordig +short myip.opendns.com @resolver1.opendns.com. Full reference: Find your public IP on Linux. - Windows: in PowerShell:
Invoke-RestMethod ip.getpublicip.com, ornslookup myip.opendns.com resolver1.opendns.com. Full reference: Find your IP on Windows. - macOS:
curl -4 ip.getpublicip.comin Terminal for your public IP; System Settings → Network → Details → TCP/IP for your local IP. Full reference: Find your IP address on a Mac. - Phone / tablet: open a what-is-my-IP page in any browser; the public IP shown is your carrier's, which on mobile is almost always shared and dynamic.
- Router: check the WAN or "Internet" status page. If the WAN address differs from your public IP, you are behind your ISP's NAT.
IPv4 vs IPv6
Many connections now have both. IPv4 (e.g. 203.0.113.4) is still what most of the internet uses to reach a server, so it's the address that matters for self-hosting. IPv6 (e.g. 2001:db8::1) is increasingly assigned alongside it. Add the -4 or -6 flag to curl (curl -4 ... / curl -6 ...) to force one or the other.
Is your IP dynamic or behind CGNAT?
Finding your public IP is also how you diagnose two common self-hosting blockers:
- Dynamic IP: note your public IP, then check again after a router reboot or a day later. If it changed, it's dynamic, and any service pointed at it will eventually break.
- CGNAT: if your router's WAN address sits in
100.64.0.0/10(100.64.x.x–100.127.x.x), or never matches your public IP, your ISP is sharing one address across many customers. Inbound connections can't reach you. See self-hosting behind CGNAT.
If you hit either problem and need an address that stays yours and accepts inbound traffic, the fix is a dedicated public IP: a static IPv4 and IPv6 routed to your server over an encrypted tunnel, regardless of what your ISP hands out.
Frequently Asked Questions
What is my public IP address?
Your public IP address is the address the rest of the internet sees when traffic leaves your network. The fastest way to find it is to run curl https://api.getpublicip.com/ip in a terminal (in Windows PowerShell: Invoke-RestMethod ip.getpublicip.com), or open any what-is-my-IP page in a browser. It returns your current public IPv4 (or IPv6) address.
What is the difference between a public IP and a local IP?
A local (private) IP (like 192.168.1.x, 10.x.x.x, or 172.16–31.x.x) identifies your device inside your own network and is not reachable from the internet. A public IP is the single address your router presents to the outside world. Commands like ipconfig (Windows) or ip addr (Linux) show your local IP; to see your public IP you have to ask an external service.
Why is my public IP different from what my router shows?
If your router's WAN address does not match your public IP, your ISP is translating your traffic with NAT, most often carrier-grade NAT (CGNAT). A WAN address in the 100.64.0.0/10 range (100.64.x.x to 100.127.x.x) is a tell-tale sign you are behind CGNAT and share a public IP with other customers, which blocks inbound connections and self-hosting.
Does my public IP address change?
Usually, yes. Most home and mobile connections use a dynamic IP that your ISP can change at any time. If you need an address that stays the same (to host a server, run email, or set reverse DNS), you need a static, dedicated public IP rather than your ISP's dynamic one.
Related guides
- Find your public IP on Linux: curl, wget, and dig one-liners
- Find your IP address on Windows: PowerShell and Command Prompt
- Find your IP address on a Mac: System Settings, Terminal, and the en0/en1 trap
- How to get a public IP address: when your IP isn't usable for hosting
- Self-hosting behind CGNAT: if your ISP is the blocker