hosting image
Find out your public IP with a simple command on Windows or Linux

Image Credits: Bruce Rolff / Alamy Stock Photo

Find out your public IP with a simple command on Windows or Linux

When we browse the Internet, in order for this task to be accomplished, we use various protocols such as TCP / IP, HTTPS, FTP, DNS, and more. Apart from that, we need an identifier that allows us to make requests and receive responses, and that is none other than the public IP address. In this case, what allows us to perform this task on the Internet is the public IP. Sometimes we need to know it to be able to set up a web, FTP, or game server. One of the ways we could find out is by entering a website to tell us what it is, however, you could also know your public IP with a single command.

The first thing we are going to do is know what a public IP is and the different classes that exist. Then we will see how you can find out your public IP with a simple command in a Windows 10 command prompt window. Afterward, we will end up verifying that this IP is our real public IP, and we will see what information we can obtain from it.

What is an IP and what are its types

The  IP address could be defined as a logical and unique identifier for each of the computers that are connected to a network. Today most networks are IPv4, but because we need more and more IP because there are more connected devices, we will have to migrate to IPv6 networks. To give you an idea of ​​the difference, an example of an IPv6 address could be this:


And another IPv4 address is this, which is the one we have for now: 

Regarding IPs, we can say that there are two types: those that are public and routable over the Internet, and those that are private. Regarding the private IP, we could say that they are the ones that identify each of the computers connected to our local network that are behind the NAT. A typical example might be a laptop or smartphone connected to a router's Wi-Fi network.

Then we have the public IP, which will be the identifier of our network facing the Internet. An important consideration is that we will not be able to put the one we want, and the person in charge of establishing it will be the Internet provider or ISP. Then they could be of two kinds:

  • Static public IP, which would be ideal to mount an FTP or other server because it never changes.
  • Dynamic public IP, which will change according to what our provider decides.

How to see your public IP with a simple command in Windows


If you want to find out your public IP with a simple command it is very simple. The first thing we have to do is open a command prompt window and for this, we will follow these steps:

  1. We go to the Start Menu.
  2. We type execute and press enter.
  3. There we write CMD and press enter again.

Then we will find a command prompt window like this to enter commands.

Next, we have to write the following command and then press enter:


Then you should see your IP.

Compare the public IP of the result

After obtaining your public IP with a simple command in a command prompt window, it is time to compare the results. We are going to do it through a trusted website which is what is my IP address . com. Its operation is very simple, simply by clicking on the previous link you will be able to see your public IP.

As you have seen, we can have our public IP by executing a simple command and using OpenDNS. Finally, here you have learned how to find out your public IP with a simple command and also through the Internet.