How to find your IP address from the command line
Developers, sysadmins, and anyone working in the terminal often need to quickly check their public IP address. No browser needed — just a single command. heresmyip.com is designed for exactly this: when you curl it, you get your IP in plain text.
Quick start
The fastest way to get your public IP address from any terminal:
Returns your IP as plain text with a trailing newline — ready to pipe, store in a variable, or use in a script.
Available endpoints
heresmyip.com provides multiple endpoints depending on what data you need:
JSON response example
{
"ip": "203.0.113.42",
"city": "Madrid",
"region": "Madrid",
"country": "Spain",
"countryCode": "ES",
"latitude": 40.4165,
"longitude": -3.7026,
"timezone": "Europe/Madrid",
"asn": 12345,
"org": "Example ISP S.A."
}Using wget, PowerShell, and other tools
Not everyone has curl installed. Here are alternatives for different environments:
wget (Linux/macOS)
PowerShell (Windows)
Python
Common use cases in scripts
Store IP in a variable (bash)
Check if your VPN is active
If the city and org match your VPN provider instead of your ISP, the VPN is working.
Update a DNS record (example)
Useful for dynamic DNS setups where your public IP changes periodically.
Why use heresmyip.com?
- -Plain text by default — No HTML parsing needed. curl gets the IP, browsers get the full page.
- -JSON endpoint — Get IP, location, ISP, and timezone in one request.
- -No rate limits — Use it in scripts, cron jobs, and CI/CD pipelines without worrying about throttling.
- -No tracking — We do not log requests or store any data. Your IP is processed in real time and discarded.
- -CORS enabled — Use it from frontend JavaScript applications with
fetch('https://heresmyip.com/json')