Get your public IP address using command-line

Modified on Wed, Sep 28, 2022 at 8:32 AM

Sometimes we need to verify what our external IP address is. Let’s see how we can get the public IP information using command-line in Windows. Please note that you need to be connected to the Internet to use the below-mentioned commands and services.

If you have a home network, you can run these commands on one device even if multiple devices are connected to the Internet. They should all have the same public IP.

Find your public IP address using Command Prompt

You can get public IP information using the command nslookup and the OpenDNS service. Just run the following command on your command prompt and you will get your external IP address.

The following command will get you the public IP address of your computer:


nslookup myip.opendns.com resolver1.opendns.com


nslookup external ip address
nslookup external IP address

Find public IP address of your computer using PowerShell

You can also use PowerShell to get the external/public IP without using any third-party IP lookup tool.

Open PowerShell by going to Run –> powershell. Run the following command to get the public IP address of your computer:

(Invoke-WebRequest ifconfig.me/ip).Content.Trim() 
Get my IP using PowerShell
Get my IP using PowerShell

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article