How to Find the Country of an IP Address
In this article
To determine the country of an IP address, you can use a free online IP geolocation service (like ipinfo.io, whatismyip.com, or iplocation.net) or run a simple command on your computer. The service will return the country, region, city, and often the ISP associated with that IP. This works because IP addresses are allocated to specific regions by regional internet registries, and the data is mapped in public databases. You only need the IP address itself (e.g., 8.8.8.8) — no special tools required.
What You'll Need
- The IP address you want to look up (IPv4 or IPv6). If you don't have one, you can find your own public IP by searching "what is my IP" on Google.
- A web browser or a command-line terminal (on Windows, Mac, or Linux).
- An internet connection.
Step-by-Step
- Get the IP address. If you're looking up someone else's IP (e.g., from a server log or email header), copy it exactly. If you need your own, open a browser and go to a site like whatismyip.com — it will display your public IP address.
- Open a geolocation website. In your browser, go to a free IP lookup service. Popular options include:
- ipinfo.io
- whatismyip.com
- iplocation.net
- ip2location.com
- Enter the IP address. Find the search box on the site — usually labeled "IP Lookup" or "Enter IP Address." Paste or type the IP and press Enter or click the lookup button.
- Read the results. The site will show details like:
- Country (e.g., United States)
- Region/State and City
- Latitude and Longitude (approximate)
- ISP (Internet Service Provider)
- Use a command-line alternative (optional). If you prefer the terminal:
- On Windows: open Command Prompt (press Win + R, type
cmd, press Enter). Then typenslookup 8.8.8.8— but this gives the hostname, not the country. For country, usecurl ipinfo.io/8.8.8.8(if curl is installed). - On Mac/Linux: open Terminal and type
curl ipinfo.io/8.8.8.8. The output will include a "country" field.
8.8.8.8with the IP you're looking up. - On Windows: open Command Prompt (press Win + R, type
- Cross-check if needed. If the result seems wrong or you need higher accuracy, try a second service (e.g., ip2location.com) and compare. Different databases may have slightly different data.
Common Mistakes
- Using a private IP address. IPs like 192.168.x.x, 10.x.x.x, or 172.16.x.x are local to your home network — they don't have a country. You need a public IP (one that's routable on the internet).
- Expecting exact physical location. IP geolocation is approximate. It can pinpoint the country and often the city, but it's not GPS-accurate. Don't expect a street address.
- Confusing the IP with the hostname. Some lookups show a hostname (like google.com) — that's not the country. Look for the "country" field specifically.
- Forgetting that VPNs and proxies mask location. If the IP belongs to a VPN service, the country shown will be the VPN server's location, not the user's actual location.
Tips
- For the most accurate results, use a service that updates its database frequently, like ipinfo.io or MaxMind (used by many sites).
- If you need to look up many IPs, consider using a bulk lookup tool (some sites allow pasting a list).
- Remember that IPv6 addresses work the same way — just paste the full IPv6 address.
- If you're investigating a suspicious email, the IP in the email header may be the sender's mail server, not the sender's device. Check the "Received" lines carefully.
Troubleshooting
If the lookup returns no country or an error:
- Make sure the IP is public and correctly formatted (e.g., 8.8.8.8, not 8.8.8).
- Try a different service — some databases may not have data for certain IP ranges.
- If you're using a command-line tool and curl isn't installed, install it or use a web browser instead.
If the country seems wrong:
- Check if the IP is from a VPN, proxy, or cloud provider (like AWS or Google Cloud) — these often have IPs registered in one country but used worldwide.
- Cross-check with another service. If two services agree, it's likely correct.
If the site is blocked or not loading:
- Try a different site (e.g., ip2location.com instead of ipinfo.io).
- Clear your browser cache or try incognito mode.
Frequently Asked Questions
Can I find the exact street address from an IP?
No. IP geolocation only gives an approximate location, usually the city or region. It cannot provide a street address.
Is IP location data 100% accurate?
No. Accuracy varies by country and IP type. It's usually correct at the country level, but city-level accuracy can be off, especially for mobile networks.
Do VPNs change the country of an IP address?
Yes. When you use a VPN, the IP address you appear to have is the VPN server's IP, so the country shown will be the server's location, not your physical location.
Can I look up the country of an IP without using a website?
Yes. You can use a command-line tool like curl with ipinfo.io, or use a programming language like Python with a library like requests to call an API.
Why does my IP show a different country than where I am?
This can happen if you're using a VPN, a corporate proxy, or if your ISP routes traffic through a different country (less common). It can also be a database error.
Is it legal to look up an IP address's country?
Yes. Public IP geolocation data is widely available and legal to access for legitimate purposes like network troubleshooting or fraud prevention.