Check Your Public IP Address from the Command Line

Get the internet-facing IP your router uses, right in the terminal.

WindowsnetworknslookupipLow risk
Run curl.exe -s https://api.ipify.org, or nslookup myip.opendns.com resolver1.opendns.com as a DNS-based alternative.

01Command

Command
$ curl.exe -s https://api.ipify.org
nslookup myip.opendns.com resolver1.opendns.com

02What 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

RiskLow risk
!Warning: A changing public IP is normal on home connections — dynamic IPs rotate periodically, so re-check before configuring port forwarding rules.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • ipify — A Simple Public IP Address API
    ipify · vendor-doc · 2026-09-17
    Evidence: Provides the api.ipify.org endpoint that returns the caller public IP as plain text, usable with curl.
  • nslookup - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: 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