IP to Timezone API: Get a Visitor's Time Zone and Currency from Their IP

Updated

Short answer

To get the time zone from an IP address, send the IP to GET https://api.iplookupapi.com/v1/info and read the timezone object: an IANA time zone ID such as Europe/Vienna, the current local time, the abbreviation, a daylight saving flag and the UTC offset in seconds. Pass the IANA ID to your date library to convert times correctly, including across DST changes. Time zone and currency data are included in every plan, including Free.

On this page

An IP to timezone lookup tells you which time zone a visitor or a log entry most likely belongs to, before any JavaScript runs. One GET request returns the IANA time zone ID, the current local time, the DST status and the UTC offset, plus the country’s currencies. Below you find the call, each field explained, IP vs browser time zones, and code for curl, Node.js, Python and PHP.

Your own public IP address and the time zone it maps to are shown below. If you use a VPN, you will see the VPN exit location, not yours.

Your public IP address

216.73.216.128

Location
Columbus, Ohio, United States
Provider
Anthropic, PBC (AS16509)
Time zone
America/New_York (UTC−4)
Coordinates
39.96, -83.00

This is the address websites see, and the location is an estimate that can be off by a city or more. Your device's local IP (often 192.168.x.x) is a different one and only works inside your network.

How to get the time zone from an IP address

Send the IP address to GET /v1/info. The fields parameter limits the response to the data you need. Put your API key in the apikey header rather than the URL, so it stays out of access logs.

Shell
curl -H "apikey: YOUR_API_KEY" \
  "https://api.iplookupapi.com/v1/info?ip=80.110.0.1&fields=ip,timezone,location.country.timezones,location.country.currencies"

The response for this Vienna, Austria address looks like this:

JSON
{
  "data": {
    "ip": "80.110.0.1",
    "location": {
      "country": {
        "currencies": [
          {
            "symbol": "€",
            "name": "Euro",
            "symbol_native": "€",
            "decimal_digits": 2,
            "rounding": 0,
            "code": "EUR",
            "name_plural": "Euros",
            "type": "fiat"
          }
        ],
        "timezones": ["Europe/Vienna"]
      }
    },
    "timezone": {
      "id": "Europe/Vienna",
      "current_time": "2026-10-14T16:46:37+02:00",
      "code": "CEST",
      "is_daylight_saving": true,
      "gmt_offset": 7200
    }
  }
}

Without ip, the API answers for the caller’s own IP, which on a server is your server, so always pass the visitor’s IP. All parameters are in the info endpoint documentation.

What each time zone field means

FieldExampleMeaning
timezone.idEurope/ViennaIANA time zone ID. Store this one and pass it to your date library.
timezone.current_time2026-10-14T16:46:37+02:00Local date and time at the moment of the request, ISO 8601 with offset.
timezone.codeCESTAbbreviation for the current period. Good for display, not for calculations, because abbreviations are not unique.
timezone.is_daylight_savingtrueWhether daylight saving time is in effect right now.
timezone.gmt_offset7200Current offset from UTC in seconds (7200 = UTC+2). Negative west of UTC, for example -18000 for UTC-5.
location.country.timezones["Europe/Vienna"]All IANA IDs used in the country.

IDs such as America/New_York come from the IANA time zone database, which operating systems, browsers and languages use. Each ID carries the offset and DST rules for its area.

Countries with several time zones

The timezone object follows the city and region of the IP address, not the country. In the US, an IP in Chicago returns America/Chicago and an IP in Phoenix returns America/Phoenix, which does not observe DST. location.country.timezones lists every ID of the country, useful for a short pick list when the city is unknown.

IP time zone vs browser time zone

In the browser, one line returns the time zone the user’s device is set to. It needs no API key:

JavaScript
const browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; // e.g. "America/Chicago"
SituationBetter sourceWhy
Showing times in your web app while the user is on the pageBrowserReflects the device setting, also when a VPN is on
First request, before any JavaScript runsIPServer-side rendering needs a value immediately
Emails, push notifications, reportsIP (from sign-up or last login)No browser is involved when you send
Server logs, API clients, support ticketsIPOnly the IP address is known
Fraud and risk checksBothA mismatch between them is a useful signal

For fraud checks, compare UTC offsets, not IDs: America/Detroit and America/New_York show the same clock time. In the browser, -new Date().getTimezoneOffset() * 60 gives the current offset in seconds, with the same sign as gmt_offset. A gap of several hours is worth a second look, not proof of fraud, since travelers cause the same pattern.

What you can do with IP time zone data

  • Send emails and notifications at local times. Schedule a newsletter for 9:00 AM in each recipient’s time zone instead of one global time.
  • Show local times and dates. Render event times, deadlines and opening hours in the visitor’s time zone on the first page load.
  • Prefill sign-up forms. Preselect the time zone field so users only confirm it.
  • Schedule meetings. Suggest slots in the invitee’s working hours.
  • Spot risky sessions. Flag logins where IP and browser time zones are far apart.

To process existing customer lists or log files, send up to 1,000 addresses per request with the batch IP lookup API.

Daylight saving time: store the IANA ID, not the offset

gmt_offset, code and is_daylight_saving describe the current moment only. Vienna is UTC+2 in summer and UTC+1 in winter, so a January reminder based on a stored 7200 fires an hour off. Store timezone.id and let a date library apply the IANA rules for each date.

Note

Do not build your own DST logic from offsets or abbreviations. JavaScript Intl, Python zoneinfo and PHP DateTimeZone already contain the IANA rules and handle transitions correctly.

Code examples: Node.js, Python and PHP

All examples read the key from the environment variable IPLOOKUPAPI_KEY.

Warning

Run the API call on your server, never in browser code. A key in client-side JavaScript is visible to every visitor. Your server sees the visitor’s IP in the request and can look it up there.

Node.js: format a time in the visitor’s time zone

Requires Node.js 18 or later (built-in fetch).

JavaScript
const API_KEY = process.env.IPLOOKUPAPI_KEY;

async function lookupTimezone(ip) {
  const url = new URL("https://api.iplookupapi.com/v1/info");
  url.searchParams.set("ip", ip);
  url.searchParams.set("fields", "ip,timezone,location.country.currencies");

  const res = await fetch(url, { headers: { apikey: API_KEY } });
  if (!res.ok) {
    throw new Error(`Lookup failed with HTTP ${res.status}`);
  }
  const body = await res.json();
  return body.data;
}

async function main() {
  const data = await lookupTimezone("80.110.0.1");
  const timeZone = data.timezone.id; // "Europe/Vienna"

  const webinarStart = new Date("2026-12-03T17:00:00Z");
  const local = new Intl.DateTimeFormat("en-US", {
    timeZone,
    weekday: "long",
    month: "long",
    day: "numeric",
    hour: "numeric",
    minute: "2-digit",
    timeZoneName: "short",
  }).format(webinarStart);

  console.log(`${timeZone}: ${local}`); // Europe/Vienna: Thursday, December 3 at 6:00 PM GMT+1
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Python: schedule an email for 9:00 AM local time

Uses zoneinfo from the standard library (Python 3.9+) and requests (pip install requests). On Windows, also run pip install tzdata.

Python
import os
from datetime import datetime, time, timedelta, timezone
from zoneinfo import ZoneInfo

import requests

API_KEY = os.environ["IPLOOKUPAPI_KEY"]


def lookup_timezone(ip: str) -> dict:
    resp = requests.get(
        "https://api.iplookupapi.com/v1/info",
        params={"ip": ip, "fields": "ip,timezone,location.country.currencies"},
        headers={"apikey": API_KEY},
        timeout=5,
    )
    resp.raise_for_status()
    return resp.json()["data"]


data = lookup_timezone("80.110.0.1")
tz = ZoneInfo(data["timezone"]["id"])

now_local = datetime.now(tz)
send_date = now_local.date()
if now_local.time() >= time(9, 0):
    send_date += timedelta(days=1)

send_local = datetime.combine(send_date, time(9, 0), tzinfo=tz)
send_utc = send_local.astimezone(timezone.utc)
print(f"Send at {send_local.isoformat()} local = {send_utc.isoformat()} UTC")

zoneinfo picks the correct offset for the target date, so the email still goes out at 9:00 AM after a DST change. See the Python zoneinfo documentation for details.

PHP: local time and a UTC timestamp for storage

Works with plain PHP (allow_url_fopen enabled).

PHP
<?php
$apiKey = getenv('IPLOOKUPAPI_KEY');
$query = http_build_query([
    'ip' => '80.110.0.1',
    'fields' => 'ip,timezone,location.country.currencies',
]);

$context = stream_context_create([
    'http' => [
        'method' => 'GET',
        'header' => "apikey: {$apiKey}\r\n",
        'timeout' => 5,
    ],
]);

$body = file_get_contents("https://api.iplookupapi.com/v1/info?{$query}", false, $context);
if ($body === false) {
    exit("Lookup failed\n");
}
$data = json_decode($body, true)['data'];

$tz = new DateTimeZone($data['timezone']['id']);
$localNow = new DateTime('now', $tz);
echo 'Local time: ', $localNow->format('Y-m-d H:i T'), PHP_EOL;

// Tomorrow at 9:00 in the visitor's time zone, converted to UTC for storage
$sendAt = new DateTime('tomorrow 09:00', $tz);
$sendAt->setTimezone(new DateTimeZone('UTC'));
echo 'Send at: ', $sendAt->format('Y-m-d H:i:s'), ' UTC', PHP_EOL;

Official SDKs exist for Python (iplookupapi), PHP (everapi/iplookupapi-php), Ruby, C#, Rust and R; the SDK overview lists them. For JavaScript, fetch as above is all you need.

IP to currency: default prices by country

The same response includes location.country.currencies: for each currency of the country, the ISO 4217 code, symbol, name and decimal_digits, among others. Use it to preselect the currency in a pricing table or checkout and to format amounts with the right decimals.

Keep two caveats in mind:

  • Some countries use more than one currency. The array can then contain several entries. Pick the first one you support, and fall back to your default currency if none match.
  • The currency follows the country, not a region. EU members outside the euro area, such as Poland, Sweden or Denmark, return their own currency. Use location.country.is_in_european_union separately if you need EU membership, for example for VAT rules.

Treat the IP-based currency as a default and let buyers switch it. For country data only, see the IP to country API.

Time zone from latitude and longitude

The API takes IP addresses, not coordinates, but each response already pairs location.latitude and location.longitude with the matching timezone.id. For arbitrary GPS coordinates, you need time zone boundary polygons and a point-in-polygon check. Longitude alone is not reliable, because zone borders follow countries and states, not meridians.

Plans and limits for time zone and currency data

Time zone and currency data are included in every plan, including Free:

PlanPrice per monthRequests per month
Free$0150 (10 per minute)
Basic$9.9965,000
Professional$34.99650,000
Enterprise$74.992,500,000

Yearly billing gives you two months free. In batch lookups, each valid address counts as one request. See pricing for what each plan adds, and where am I for the time zone your own connection shows.

Tip

Cache the time zone per IP address or user account. It rarely changes, and caching saves quota.

Frequently asked questions

How do I get the time zone from an IP address?

Call GET https://api.iplookupapi.com/v1/info with the ip parameter and your API key in the apikey header. The response contains a timezone object with the IANA ID (for example America/Chicago), the current local time, the abbreviation, a daylight saving flag and the UTC offset in seconds. Use the IANA ID with a date library such as JavaScript Intl, Python zoneinfo or PHP DateTimeZone. See the info endpoint docs for all parameters.

Is the IP time zone API free?

Yes. Time zone and currency data are part of every plan, including the Free plan with 150 requests per month and 10 requests per minute. Paid plans start at $9.99 per month for 65,000 requests. See pricing for all plans.

How accurate is time zone detection by IP address?

The time zone is only as accurate as the location of the IP address. At country level it is usually right, but at city level it can be off, for example with mobile networks, company networks that route traffic through a central office, or VPNs and proxies, which show the exit location. When JavaScript runs on the user’s device, the browser time zone is more reliable for that user, so use the IP time zone as a server-side default or a fallback.

Does the API handle daylight saving time?

Yes, for the current moment. The is_daylight_saving flag, the code (such as CEST) and the gmt_offset describe the time zone at the time of the request. For any other date, store the IANA ID and let your date library apply the DST rules, because the offset changes when clocks change.

Which time zone do I get for a country with several time zones, like the US?

The timezone object is based on the city and region of the IP address, so an IP located in Denver returns America/Denver and an IP in New York returns America/New_York. The field location.country.timezones lists all time zone IDs of the country, which helps if you want to show a short pick list. If the IP has no city-level location, treat the result as a best guess and let the user confirm it.

What currency does the API return for EU countries?

The API returns the currency of the country, not of the EU. An IP in Germany or France returns EUR, while an IP in an EU country outside the euro area, such as Poland, Sweden or Denmark, returns that country’s own currency (PLN, SEK or DKK). The flag location.country.is_in_european_union tells you separately whether the country is an EU member.

Look up IP addresses in your code

iplookupapi returns the location, provider, time zone and security flags of any IP address as JSON. The free plan includes 150 requests a month.

curl "https://api.iplookupapi.com/v1/info?ip=8.8.8.8" \
  -H "apikey: YOUR_API_KEY"