Skip to main content

timezonefinder

Coordinate to IANA timezone lookup

Python package for offline timezone lookup of WGS84 coordinates, with no polygon simplification - so the answer stays correct at timezone borders.

build status documentation status wheel pre-commit total PyPI downloads monthly 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, grid-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. Where no compiler is available the optional Numba extra (pip install timezonefinder[numba]) JIT-compiles the same routine instead; the extension wins wherever it loaded. The acceleration path comparison measures all three against each other and is regenerated with every report; where it is the kernel, the extra also costs a process more resident memory than the packaged data; where the extension loaded, it is never even imported.

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>". A dataset update can change the answer for a coordinate, so pin it when a result has to stay reproducible across deployments - result stability covers what can change and what cannot.

# 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 cell in an aligned grid tree - 0.75-degree cells, refining to 0.1875 degrees where several zones meet - by one integer division per axis, 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 shortcut 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.

The dataset also contains genuinely overlapping zones, so a coordinate can match more than one - timezone_at() picks the smaller one, and timezones_at() returns all of them.

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 in this order: a clang-compiled C extension (built automatically when a compiler is available), Numba JIT compilation (used only where the C extension is unavailable and the optional numba 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 shortcut 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.

Used by

timezonefinder is the most downloaded offline timezone lookup package for Python - see the alternatives for how it compares. GitHub's dependency graph lists thousands of repositories and hundreds of published packages that depend on it, among them:

To cite timezonefinder, use the "Cite this repository" button on GitHub, which reads CITATION.cff.

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.

Metadata

Release files for timezonefinder 9.2.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.2.0
File Size Uploaded Provenance
timezonefinder-9.2.0.tar.gz 1.3 MB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for timezonefinder 9.2.0
File
timezonefinder-9.2.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl CPython 3.15 abi3, abi3t Linux musl 1.2+ x86-64 Details
timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.15 abi3, abi3t Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details
timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl CPython 3.15 abi3, abi3t Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 Details
timezonefinder-9.2.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details
timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 abi3 Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 Details
timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details

Total release size: 2.3 MB

Release files / timezonefinder-9.2.0.tar.gz

Download URL timezonefinder-9.2.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
19ce50b725890008c3b4cff3cea36bc723b717251b3186510b2f0be7e0466682
BLAKE2b-256 checksum
How to use checksums
ab180c54c79fa61c6d0ac337d60066c7aa35049272c36a972e6f8d4abc5186a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl

Download URL timezonefinder-9.2.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl
Size 157.5 kB
Tags CPython 3.15 Linux musl 1.2+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
338894db217c2d0473a0d726ff331d3de5c24fba4ebcea860507e1be9d872536
BLAKE2b-256 checksum
How to use checksums
352ecbc48374050884061ab2b077388fb9b559d70d1c94e6b02ce10bc2b60282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 157.8 kB
Tags CPython 3.15 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
92b19875d2e443f0a0d459bb0b748fd71351267348fcbf8bef3440912f575539
BLAKE2b-256 checksum
How to use checksums
44891ed4ee714ad7b2c1798ad3dac1ce741561e3ad94103fed935025669b5015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.2.0-cp315-abi3.abi3t-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 156.3 kB
Tags CPython 3.15 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 abi3 abi3t
SHA-256 checksum
How to use checksums
117e53c6579c34f91ef0032dff5a6a3ac26cdaed3c3e3179ae0793a7c010becf
BLAKE2b-256 checksum
How to use checksums
081b3dcd8af6dfacc5046b4d9d469dcdcaf47678199eb3d13166d8cfba3dccf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL timezonefinder-9.2.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 157.9 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
7af4041bc04da0b5f70ec380b8a4eb955e3333f769629689c0bb348fa20b2dd7
BLAKE2b-256 checksum
How to use checksums
4b4a6e4f9eaa89e25e90ac548e565b9db1c284f5d84d16274d3e7d1f89069f80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 158.2 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
3da2fbb3dffc40f75291fabb471acf12e3bd7e179c0f25fdd4a4b8d6810135a9
BLAKE2b-256 checksum
How to use checksums
23b29a8de20e3e8075a8f843c3be7edb8b409a06ebef1ed74306a73233674446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl

Download URL timezonefinder-9.2.0-cp312-abi3-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 156.9 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 abi3
SHA-256 checksum
How to use checksums
76dbc862a74a3706a1f88f99a059fe82150a4b06fd790f059bd39b8be977f55a
BLAKE2b-256 checksum
How to use checksums
319ad9fc995ce35a33905227ef736a95f6900e9eaed35a8ebac712dae449157a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Security for timezonefinder 9.2.0

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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for timezonefinder-9.2.0.tar.gz

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 Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

9.2.0 This release

7 release files Full provenance

7.0.0

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