Public IP Address is the assigned IP address to your device which is connected to the computer network and which can be accessed directly from the Internet.
For an example, Public IP Address can be assigned to Routers, Web Servers, E-mail servers or any other services which are directly accessible from Internet.
If Public IP address is directly assigned to your computer then you can easily find it by following the same steps, by which you can find your local IP address.
But, if there is no IP address in your LAN (Local Area Network) property or there is only a Local IP address, you can find your Public IP address by following steps.
The easiest way is visiting homepage of our website – www.ipconfig.in
This will not just show your public IP address but you will also come to know many thing about your ip address, such as , Organisation, name of Internet service provider, Country, city, zip, and even Longitude and latitude with Geographical map. You can also lookup any other Public IP address on this page to know the location and more about that IP address.
If you are looking for http/https based way or you are using Terminal or Command Prompt or you want to get a public IP into your program or code by using http protocol or just by calling curl, then following curl command would help you to get just a Public IP address as a RAW text.
Command for Linux and Mac OS and Latest versions of Windows 10:
Another way is to query a request for the IP of the domain myip.opendns.com to the DNS server resolver1.opendns.com. This server will return the IP, the request comes from.
For this you can use either “nslookup” or “dig” command. nslookup will work mostly on all the Operating systems. dig command won’t work on default Windows cmd.
nslookup myip.opendns.com resolver1.opendns.com
dig +short myip.opendns.com @resolver1.opendns.co