Check Your Public IP Address from the Command Line
Get the internet-facing IP your router uses, right in the terminal.
01Command
$ curl.exe -s https://api.ipify.org
nslookup myip.opendns.com resolver1.opendns.com02What it does
Your public IP is what websites see as your address — useful for port forwarding, remote access and whitelisting. api.ipify.org echoes it back as plain text, and curl.exe ships with Windows 10/11. The nslookup variant asks OpenDNS which source address the query arrived from, which works even where HTTP is blocked.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- ipify — A Simple Public IP Address APIEvidence: Provides the api.ipify.org endpoint that returns the caller public IP as plain text, usable with curl.
- nslookup - Windows CMDEvidence: Documents nslookup usage for querying a specific DNS server, the basis of the OpenDNS myip lookup trick.
Last verified: 2026-09-18 · Category: Network
06Related solutions
Purge cached DNS lookups so Windows re-resolves hostnames from scratch — the fix for 'the new server is live but my browser still hits the old one'.
The nuclear option for broken connectivity: rebuild Winsock and the TCP/IP stack to defaults when adapters show 'no internet' despite everything else working.
Enumerate every wireless network Windows remembers, inspect a profile's settings, and export profiles for backup or transfer to another PC.