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 the same 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 and the Windows 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) or ip addr (Linux/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-WebRequest -UseBasicParsing https://api.getpublicip.com/ip).Content, ornslookup myip.opendns.com resolver1.opendns.com. Full reference: Find your IP on Windows. - macOS — same
curlcommands as Linux in Terminal; your local IP is under System Settings → Network. - 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.
Related guides
- Find your public IP on Linux — curl, wget, and dig one-liners
- Find your IP address on Windows — PowerShell and Command Prompt
- 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
