Fork me on GitHub free public IP address API

We expose your IP address on the Internet.

This means NAT & proxies affect the results, and the answer differs from eg ipconfig, ifconfig, ip addr.

Feel free to use this service for anything, from anywhere. We handle billions of requests per month and 10× load tests. If you expect to send more than 5,000 requests per second, please E-mail first.



None so far; please share here if you build one.


You can find your public IP address at over HTTP(S), DNS, SSH, telnet(s), and STUN.

To specify IPv4 or IPv6, prefix with 4. or 6..

Over HTTP(S), access /json to get JSON instead of plain text, which includes geolocation information. Every value is a string and missing values can be empty strings (sorry), null, or undefined.

Over DNS, request any name. Over SSH, do not pass a command.

To find the public IP of your DNS servers, resolve,, or

You can also get a unique 63-bit identifier represented in hexadecimal over HTTP(S) at Falling back to is safe.

Redundancy & alternatives

If you need reliable lookups, please build redundancy. mirrors this service from another datacenter and gets maintained first.

Alternatives can be found in go-external-ip, gip (rust), WooCommerce.


Display the public IP (IPv4 or IPv6), in shell:

  (command -v dig &> /dev/null &&
    (dig +short ||
     dig +short ||
  (command -v nc &> /dev/null &&
    (nc 23 < /dev/null ||
     nc 23 < /dev/null)) ||
  (command -v curl &> /dev/null &&
    (curl -sf ||
     curl -sf ||
  (command -v wget &> /dev/null &&
    (wget -qO- ||
     wget -qO- ||
  (command -v openssl &> /dev/null &&
    (openssl s_client -quiet -connect 2> /dev/null ||
     openssl s_client -quiet -connect 2> /dev/null)) ||
  (command -v ssh &> /dev/null &&
    (ssh -qo StrictHostKeyChecking=accept-new ||
     ssh -qo StrictHostKeyChecking=accept-new ||
  (echo "Could not find public IP through" >&2
   exit 42)
echo "Found public IP $IP"

Fetch and display the public IPv4 address, in PowerShell:

$IP = try { (Invoke-WebRequest -Uri }
  catch { (Invoke-WebRequest -Uri }
Write-Output "Found public IPv4 $IP"

Securely fetch and display the public IPv6 address, in Python:

from urllib.request import urlopen
def public_ipv6():
    with urlopen('') as response:
    with urlopen('') as response:
print("Found public IPv6", public_ipv6())

Confirm the configured timezone matches geographically, in JavaScript:

async function ident() {
  try { return await(await fetch('//')).json(); }
  catch { return await(await fetch('//')).json(); }

Intl.DateTimeFormat().resolvedOptions().timeZone ===
  (await ident()).tz

ipify and seeIP have plenty of examples to draw inspiration from.


Check our status with


This service has been around since late 2012. If you'd like to increase the bus factor (one) and help keep it around, please reach out!

Privacy & logging

Logs are occasionally kept locally for public operational analytics and interactive troubleshooting, alongside traffic analysis tools.

They are not used or shared in any other way for any other purpose, unless legally required to do so.


If the response time of this service surprises you, it's probably because we're located in Europe and most alternatives are in North America. The service time itself is usually negligible, you're mostly observing network latency between your client and Germany.


In DNS, our root and any. have both A and AAAA records, 4. only has an A record, 6. only has an AAAA record; ns, ns4, and ns6 have corresponding NS records.

All records point to a cheap VPS in Nuremberg, Germany running Ubuntu Jammy with:

  1. Some sysctls for scalability;
  2. TLS certificates maintained by certbot on a timer;
  3. GeoLite2 City & GeoLite2 ASN maintained by geoupdate on a timer;
  4. nginx with a short configuration;
  5. OpenSSH configured with Port 2222 in /etc/ssh/sshd_config;
  6. identssh;
  7. identdns;
  8. identtelnet;
  9. identhttp;
  10. stuntman;
  11. No crash reporting.

Supporting the service

I welcome sponsorships on GitHub.

Remarks, requests, suggestions? Contact Pierre Carrier.