geoprimsField-grade geospatial math

Latitude, longitude, and height to ECEF

Converts geodetic latitude, longitude, and ellipsoidal height to Earth-centered, Earth-fixed X, Y, Z.

Go the other way: ECEF to latitude, longitude, and height →

845,580.01m

ECEF X 845,580.01 m, Y -4,786,836.717 m, Z 4,116,002.385 m.

Y
Z
Provenance
Computed by
geodesy.frame.geodetic-to-ecef 1.0.0, core 0.1.0
Model
Geodetic to ECEF, WGS 84
Accuracy
Exact formula in double precision; matches GeographicLib CartConvert to 1 µm
Notes
None
Cites
Karney, C. F. F., GeographicLib, GeographicLib Geocentric and LocalCartesian classes; National Geospatial-Intelligence Agency, Department of Defense World Geodetic System 1984, NGA.STND.0036

Something look off?

Your values

Showing an example. Change anything.
More options 2
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: X = (N + h) cosφ cosλ, Y = (N + h) cosφ sinλ, Z = (N(1 − e²) + h) sinφ

Accuracy: Exact formula in double precision; matches GeographicLib CartConvert to 1 µm

When to use this: Use this when a calculation wants Cartesian coordinates rather than angles: baselines between stations, vector arithmetic on positions, satellite geometry, or feeding a system that works in X, Y, Z. It takes latitude, longitude, and ellipsoidal height on the ellipsoid you choose. It is also the step before any vector arithmetic between two positions: differences, baselines, and rotations are done in Cartesian space, not on latitudes and longitudes.

Limitations: The height must be ellipsoidal; passing a height above mean sea level puts the point off by the geoid separation, which reaches tens of meters. The result is only as well defined as the frame its input belongs to, and this tool converts coordinates rather than datums, frames, or epochs. The ellipsoid matters: the same latitude, longitude, and height on a different ellipsoid gives different X, Y, Z, so the ellipsoid has to be the one the coordinates belong to.

Worked example: Pittsburgh at 300 m. Source: add-geodesy-suite scenario: X ≈ 845,580.010 m, Y ≈ −4,786,836.717 m, Z ≈ 4,116,002.385 m. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

Ellipsoidal height
300 m
Latitude
40.446111 deg
Longitude
-79.982222 deg

You get

X
845,580.01 m
Y
-4,786,836.717 m
Z
4,116,002.385 m

Review: Not yet independently reviewed by a geodesist.

Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Changes

Checked against: 25 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources

Terms

ECEF: Earth-centered, Earth-fixed
Cartesian X, Y, Z coordinates in meters from Earth's center, turning with the Earth. X points to 0° longitude on the equator and Z to the North Pole. Source: Department of Defense World Geodetic System 1984