Skip to main content
Coordinate to IANA timezone lookup

Offline timezone lookup for WGS84 coordinates, with no polygon simplification - so the answer stays correct at timezone borders.

https://github.com/jannikmi/timezonefinder/actions/workflows/build.yml/badge.svg?branch=master documentation status https://img.shields.io/pypi/wheel/timezonefinder.svg pre-commit total PyPI downloads latest version on PyPI latest version on conda-forge supported python versions linted and formatted with ruff

In comparison to other alternatives this package aims at maximum accuracy around timezone borders while offering fast lookup performance and compatibility with many (Python) runtime environments. It combines preprocessed polygon data, H3-based spatial shortcuts, and optional acceleration via Numba or a clang-backed point-in-polygon routine.

Quick Guide

pip install timezonefinder

This compiles a small C extension for the point-in-polygon test. The optional Numba extra (pip install timezonefinder[numba]) replaces that extension with a JIT-compiled kernel and takes precedence over it - a dispatch rule, not a promise of more speed. The acceleration path comparison measures all three against each other and is regenerated with every report; check it before adding the extra.

The timezone boundary data is installed automatically as the separate timezonefinder-data distribution, so that a new dataset ships without a new timezonefinder release. Pin it to hold a deployment to one dataset - the release history lists the versions to choose from: pip install timezonefinder "timezonefinder-data==<version>".

# use the global function for convenience:
from timezonefinder import timezone_at

tz = timezone_at(lng=13.358, lat=52.5061)  # 'Europe/Berlin'


# For improved performance and control, reuse one instance for the whole job.
# The context manager releases its coordinate data even if the job raises:
from timezonefinder import TimezoneFinder

with TimezoneFinder(in_memory=True) as tf:
    tz = tf.timezone_at(lng=13.358, lat=52.5061)  # 'Europe/Berlin'

    # Many coordinates at once, one array per axis - ids for a caller that maps
    # them itself, names for one that does not:
    lngs = [13.358, 2.3522]
    lats = [52.5061, 48.8566]
    zone_ids = tf.timezone_ids_at(lngs=lngs, lats=lats)
    names = tf.timezone_names_at(lngs=lngs, lats=lats)
    # ['Europe/Berlin', 'Europe/Paris']

Note: This library uses the full original timezone dataset with all >440 timezone names, providing full localization capabilities and historical timezone accuracy. For applications that prefer a smaller memory footprint, the reduced “timezones-now” dataset is available via the update_data.sh script (cf. Documentation).

How it works

A lookup scales the coordinates to 32-bit integers (x 10^7, ~1.1 cm steps), finds the point’s H3 hexagon at resolution 4, and reads a precomputed shortcut for that cell. Most cells are covered by a single timezone, so the answer is returned immediately with no geometry touched at all. Only an ambiguous cell falls through to the polygons it lists: bounding-box rejection first, then a ray-casting point-in-polygon test - holes before the outer ring, since holes are smaller and can reject the polygon outright.

The central trade-off: the boundary polygons are never simplified, so border accuracy is limited only by the source dataset. The H3 index is what makes carrying full-resolution geometry affordable.

Since the dataset includes ocean zones, every coordinate on earth matches some timezone - use timezone_at_land() when you need to tell land from sea.

Performance

Hundreds of thousands of lookups per second on a single core for uniformly random query points. The exact figure depends on the acceleration backend, the machine and the dataset version, so the benchmark reports below carry it - each states the configuration it was measured in - rather than this page, which would go stale.

The point-in-polygon routine has three interchangeable backends, selected at import time: a clang-compiled C extension (built automatically when a compiler is available), Numba JIT compilation (preferred when the optional dependency is installed), and pure Python. All three return identical answers - a missing compiler costs speed, never results. Which is fastest is measured, not assumed: see the acceleration path comparison.

Engineering notes

  • Architecture - the lookup pipeline, the acceleration backends, and the ceilings this package deliberately does not exceed

  • Data Format - binary layouts, coordinate scaling and the H3 index

  • Benchmarking Methodology - the measurement design and where every threshold comes from

  • Testing philosophy - the tests that exist because a rule needed a failure mode, plus the property-based suite and the version/backend matrix

  • How it ships - abi3 wheels, three libc targets, and the checks that stop a broken wheel reaching PyPI

  • Alternatives - the trade-offs against tzfpy, and when to choose it instead

  • Changelog

Alternative: Need maximum speed at the cost of accuracy? Check out tzfpy - a fast and lightweight alternative based on Rust.

Contributing

Looking for maintainers. Reach out if you want to contribute!

Contribution guidelines, the development workflow and the testing/benchmarking gates are documented in CONTRIBUTING.md.

References

LICENSE

timezonefinder is licensed under the MIT license.

The data ships in the separate timezonefinder-data distribution and is licensed under the ODbL license, following the base dataset from evansiroky/timezone-boundary-builder.

Release files for timezonefinder 9.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timezonefinder 9.0.0
File Size Uploaded
timezonefinder-9.0.0.tar.gz 1.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for timezonefinder 9.0.0
File Interpreter ABI Platform
timezonefinder-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.11 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl CPython 3.11 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 Details

Total release size: 1.7 MB

Release files / timezonefinder-9.0.0.tar.gz

Download URL timezonefinder-9.0.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
c21c47f1463320eda57c4cbb5b80e875b80e64d6b78e73477e0f8bdc1a112c04
BLAKE2b-256 checksum
How to use checksums
52bce347fcf40a1118c3c0b709eafc53f540d015497a108dab671e84c5834048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / timezonefinder-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL timezonefinder-9.0.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 148.1 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
2e0533ed629aff05b00f2a2d1bb92b23b79ee5a5ed7e4a3608286efb8eee8679
BLAKE2b-256 checksum
How to use checksums
9395ce2190257eab552963740d5bef262e9991cc80877ad2cc8cc3c84a01e347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 148.5 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
c824ed2acd207d4a125cf75c2c3b4c6c30ec4636bb02bb15021ee1b598d279fb
BLAKE2b-256 checksum
How to use checksums
87c8c7222c41a51e03add849dd28fd75b852e1f160b3100838d96b32728a5900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.0.0-cp311-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 147.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
c259de79c20a32c5fbe2a372232f93a5fd481c487bc0e1b27836d4958bbf2c82
BLAKE2b-256 checksum
How to use checksums
c4715370c9ac7c810b501f87036ec4c3ce5d8a74b0a3d93ab2643677e7a57198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

9.0.0 This release

4 release files

8.3.0

4 release files

8.2.5

4 release files

8.2.4

4 release files

8.2.3

3 release files

8.2.2

3 release files

8.2.1

3 release files

8.2.0

3 release files

8.1.0

3 release files

8.0.0

11 release files

7.0.1

11 release files

7.0.0

6.6.3

11 release files

6.6.2

11 release files

6.5.9

19 release files

6.5.8

13 release files

6.5.5

7 release files

6.5.4

7 release files

6.5.3

6 release files

6.5.2

6 release files

6.5.1

6 release files

6.5.0

2 release files

6.4.1

2 release files

6.4.0

2 release files

6.3.0

2 release files

6.2.0

2 release files

6.1.10

2 release files

6.1.9

2 release files

6.1.8

2 release files

6.1.7

2 release files

6.1.6

2 release files

6.1.5

2 release files

6.1.4

2 release files

6.1.3

2 release files

6.1.2

2 release files

6.1.1

2 release files

6.1.0

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.2.0

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.0

3 release files

4.5.0

2 release files

4.4.1

2 release files

4.4.0

2 release files

4.3.1

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.3

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.4.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page