How to look up your external IP address from Command Prompt on Windows 10

How to look up your external IP address from Command Prompt on Windows 10

The Command Prompt on Windows 10 has a useful utility called ipconfig that lets you look up your IP address, view network information, and information about the network cards installed on your system. The IP address that it returns though isn’t your external IP. It’s your internal IP i.e., the one assigned to you within your network by your router. If you want to look up your external IP, you can Google ‘What is my IP?’ and you will get a different address. If you need to look up your external IP address from the Command Prompt, it’s a little complicated.

The ipconfig utility cannot tell you what your external IP is. This is because you’re never connected directly to the internet. Your router acts as an intermediary which is why this information can’t be looked up. There is a simple work around though.

External IP address from Command Prompt

What you need to do is pull your external IP from a website that can see it and also return the information. Your external IP isn’t hidden from websites unless you mask it with a VPN on Windows for privacy so all websites can see. The trick is finding a website that can also return that same information in Command Prompt. To do that, run the command below.

nslookup myip.opendns.com. resolver1.opendns.com

This will return your external IP address as seen by opendns.com. OpenDNS is basically just that; an open and free DNS that you can use if you want to. It’s a website that can, like all other websites, see your external IP address and it can display that information for you.

There are loads of other websites that can return this sort of information and you can use them instead if you want to. The command/script that you need might be a bit more complicated in some cases, but it’s still possible.

You can also look up your external IP in PowerShell. Open PowerShell and run the following command;

(Invoke-WebRequest ifconfig.me/ip).Content.Trim()

It will return your external IP address.

If you get errors with this command, open Internet Explorer and set its default settings. This is necessary or the Invoke-WebRequest command won’t work. If you’ve uninstalled Internet Explorer, you can install it again by enabling it from additional Windows features. You can access additional features from both the Settings app and the Control Panel.

You do not need admin rights to view your external IP address from Command Prompt or from PowerShell.