HackMyIP
← back to sheets

How to Check Your IP From the Command Line (curl what is my IP)

~/sheets/curl-what-is-my-ip.md
1

The Short Answer

2

To see your public IP address from a terminal, run curl hackmyip.com. It prints your IP, city, country, and network (ASN + ISP) as clean colored text. No install beyond curl, which already ships on macOS, Linux, and Windows 10/11. No signup, no API key. For just the raw fields as JSON, run curl hackmyip.com/json. Open the web version of this check if you prefer a browser.

3

The One-Liner

4
curl hackmyip.com
5

That returns a short, readable block: your IP on its own line, then location and network. Because the IP is on its own line, you can pipe it. To grab just the address:

6
curl -s hackmyip.com/json | grep -o '"ip": *"[^"]*"'
7

How It Detects the Terminal

8

When you hit hackmyip.com with curl, wget, or another command-line client, the site looks at your User-Agent and serves plain text instead of the HTML page. A browser still gets the full site. There is no separate endpoint to remember — the same root URL adapts to whoever is asking. If you want to force the machine-readable shape from anywhere, use curl hackmyip.com/json.

9

Other Clients

10

wget

11
wget -qO- hackmyip.com
12

PowerShell (Windows)

13
(Invoke-WebRequest hackmyip.com/json).Content | ConvertFrom-Json
14

Python

15
python3 -c "import urllib.request,json;print(json.load(urllib.request.urlopen('https://hackmyip.com/json')))"
16

When You Want More Than the IP

17

The terminal one-liner is deliberately short. For richer data there is a free public API with no key: see the full API docs. For example, curl https://hackmyip.com/api/ip returns geolocation, ISP, ASN, and a VPN/proxy/datacenter classification. To look up a different address, use curl 'https://hackmyip.com/api/lookup?ip=8.8.8.8'.

18

Browser-side privacy checks that a terminal cannot do — like detecting whether your VPN is leaking — live on the site: run a DNS leak test or a WebRTC leak test, or check whether your IP looks like a proxy or VPN.

19

Frequently Asked Questions

20

How do I check my IP address from the command line?

21

Run curl hackmyip.com in any terminal. It prints your public IP plus your city, country, and network. curl is preinstalled on macOS, Linux, and Windows 10 and 11. For machine-readable output, use curl hackmyip.com/json.

22

What does "curl what is my IP" return?

23

It returns your public IP address as seen by the internet, along with your approximate location (city, region, country) and your network (ASN and ISP). The plain IP is on its own line so you can pipe or copy it. There is no signup and no API key.

24

How do I get my IP as JSON from curl?

25

Run curl hackmyip.com/json. It returns a small JSON object with ip, city, country, asn, and org. For richer fields including VPN/proxy detection, use the free no-key API at curl https://hackmyip.com/api/ip.

26

Does this work on Windows?

27

Yes. Windows 10 and 11 ship curl, so curl hackmyip.com works in Command Prompt and PowerShell. You can also use (Invoke-WebRequest hackmyip.com/json).Content in PowerShell for the JSON form.

28

Is it free and does it require an account?

29

Yes, it is free, and no. There is no signup, no API key, and no rate-limit registration for the basic IP check. HackMyIP is a free privacy toolkit; the terminal one-liner and the JSON endpoint are open to anyone.

30
Last updated: June 28, 2026