Command-Line IP Lookup (curl, JSON)
Get your public IP address from the terminal with curl, wget or PowerShell, or as JSON with location, ASN and timezone. Free, no key, CORS enabled.
FindMyIPLocation answers command-line tools with plain text, so you can get your public IP address in scripts, servers and terminals without parsing HTML.
Your IP address
curl findmyiplocation.com
Returns just your IP address and a line break. It works with wget -qO- findmyiplocation.com, HTTPie (http findmyiplocation.com) and similar tools.
IPv4 or IPv6 explicitly:
curl -4 findmyiplocation.com
curl -6 findmyiplocation.com
PowerShell:
(Invoke-RestMethod https://findmyiplocation.com/ip).Trim()
Single values
| Address | Returns | Example |
|---|---|---|
/ip |
Your IP address | 203.0.113.42 |
/country |
Two-letter country code | DE |
/city |
City | Frankfurt am Main |
/asn |
Network number | AS64500 |
/org |
Network name | Example Telecom GmbH |
/timezone |
Timezone | Europe/Berlin |
curl findmyiplocation.com/country
JSON
curl findmyiplocation.com/json
{
"ip": "203.0.113.42",
"version": 4,
"country": "Germany",
"country_code": "DE",
"region": "Hesse",
"city": "Frankfurt am Main",
"postal": "60311",
"latitude": 50.1109,
"longitude": 8.6821,
"timezone": "Europe/Berlin",
"asn": 64500,
"org": "Example Telecom GmbH",
"continent": "Europe",
"eu": true
}
The /json endpoint sends Access-Control-Allow-Origin: *, so you can call it from JavaScript in the browser:
const me = await fetch('https://findmyiplocation.com/json').then((r) => r.json());
Examples
Use your IP in a shell script:
MYIP=$(curl -s findmyiplocation.com)
echo "Allowing $MYIP in the firewall"
Python:
import urllib.request
print(urllib.request.urlopen("https://findmyiplocation.com/ip").read().decode().strip())
Fair use
- Free, no sign-up and no API key.
- Up to 120 requests per minute per IP address. For monitoring, one request every few minutes is plenty.
- Responses are never cached, so you always get your current address.
- Locations are approximate. See how accurate IP geolocation is.
These endpoints describe your own connection only. To look up other addresses, use the IP Lookup or Bulk IP Lookup in your browser.