Every coordinate system with a third number calls it z, and that shared letter causes real confusion, because the three common z's are different quantities with different methods. In a 3D graph, z is height above the flat xy plane, and you calculate it from the surface's equation. In GIS, z is usually elevation, a height above sea level attached to a map point, and you look it up or measure it rather than calculate it. In the Earth centered system GPS uses internally, Z is one of three distances from the planet's center, measured in millions of meters, and you calculate it from latitude, longitude, and height with the WGS 84 formulas. This guide takes each in turn, with worked numbers.
Home / Coordinates and Location Formats
How to Calculate the Z Coordinate: Three Different Z's, Three Different Answers

Photo: Ylanite Koppens / Pexels
Coordinate Converter: Verify the Pair Before You Compute Z
Every z calculation, from a classroom plane to the WGS 84 formulas in this article, starts from a clean x and y. Check your pair here in decimal degrees, DMS, and DDM first, then work the third coordinate with confidence.
From decimal degrees
Your latitude breaks down as 40 degrees, 41 minutes, 21.00 seconds. One degree is 60 minutes, one minute is 60 seconds, so a second of latitude is about 31 meters on the ground.
From degrees minutes seconds
Conversions use the WGS 84 coordinate system, the same one GPS satellites and phone maps use. Plus codes are computed with the open location code algorithm, the same method Google Maps uses.
Z Number One: Height Above the Plane in 3D Mathematics
In a 3D Cartesian graph, a point is (x, y, z), and z is found the same way x and y are: it is the count along the third axis, perpendicular to the plane, positive upward. If the point is plotted, you read z by dropping to the plane and measuring the height. If the point lies on a surface given by an equation, you calculate z by substituting the known x and y into that equation.
Worked example, a flat plane. A plane is given by z = 2x + 3y + 1. At the point where x = 2 and y = 1: z = 2 times 2, plus 3 times 1, plus 1, which is 4 + 3 + 1 = 8. The point is (2, 1, 8).
Worked example, the general plane form. Planes are often written as ax + by + cz + d = 0, and z is isolated by moving the other terms across and dividing by c. Take 2x + 3y + 6z = 12. At x = 1, y = 2: 2 + 6 + 6z = 12, so 6z = 4, and z = 0.667. Two habits keep this honest: substitute back to check (2 + 6 + 6 times 0.667 = 12, correct), and remember that a vertical plane, one with c = 0, has no single z for given x and y at all; the method fails loudly there, which is information, not an error.
The Cartesian foundation under this z, axes, order, and signs, is the same ground our Cartesian coordinates guide builds. In pure mathematics the story ends here. On a map site it is only the first of three.
Z Number Two: Elevation in GIS
When a GIS dataset, a shapefile, a GPS track, or a 3D map carries a z value, it almost always means elevation: the height of that point above a reference surface, usually mean sea level. You rarely calculate this z; you obtain it, from a digital elevation model lookup, from a survey, or from a device. Three facts govern it.
First, the reference matters. Heights come in flavors: height above the ellipsoid (the smooth mathematical Earth GPS natively uses), and height above the geoid, which approximates sea level and is what maps and people mean by elevation. The two differ by tens of meters in places, and mixing them is the classic z error in GIS. Our explainer on what elevation is separates these properly.
Second, GPS altitude is the ellipsoid flavor, and it is the least accurate part of any GPS fix, routinely off by more than the horizontal position. A phone reporting your elevation is reporting a model-dependent estimate; a hiker quoting summit heights from a phone is quoting the softest number the device produces.
Third, a missing z is not a zero z. Plenty of map data is 2D, and software that needs a z will silently use 0, which places your mountain road at sea level. When a dataset's z values are all zero, suspect absence, not a very flat place.

Z Number Three: The Z of Earth Centered XYZ
GPS does its internal geometry in a system with its origin at the Earth's center of mass: X points toward the equator at longitude zero, Y toward the equator at longitude 90 east, and Z toward the north pole. Converting latitude, longitude, and height into X, Y, Z uses the WGS 84 ellipsoid formulas, with a = 6,378,137 meters (the equatorial radius) and e squared = 0.00669437999014 (the ellipsoid's flattening factor):
- N = a divided by the square root of (1 minus e squared times sin squared of latitude)
- X = (N + h) times cos latitude times cos longitude
- Y = (N + h) times cos latitude times sin longitude
- Z = (N times (1 minus e squared) + h) times sin latitude
Here h is height above the ellipsoid, and the angles are latitude and longitude. Three anchor points make the outputs checkable. On the equator at longitude zero with h = 0, the formulas give X = 6,378,137.0, Y = 0, Z = 0: you are one equatorial radius from the center, on the X axis itself. At the north pole, Z reaches 6,356,752.3 meters, the polar radius, noticeably less than the equatorial radius, because the Earth is flattened. And for a real landmark, the Statue of Liberty (latitude 40.689167, longitude minus 74.044444, h = 0) gives X = 1,331,345.9, Y = minus 4,656,584.3, Z = 4,136,310.6 meters. Notice what Z means here: not a height above anything you can stand on, but the point's distance from the equatorial plane, measured through the planet. Our dedicated guide to converting GPS coordinates to XYZ works this system fully, including the return trip.
Which Z Do You Actually Need?
| Your situation | Your z | Method |
|---|---|---|
| A math problem with a surface equation | Height above the xy plane | Substitute x and y into the equation |
| A point plotted on a 3D graph | The third axis count | Read the height above the plane |
| A map point, track, or GIS layer | Elevation above sea level (usually) | Look it up from elevation data; check ellipsoid versus geoid |
| GPS internals, satellite work, XYZ data | Earth centered Z | The WGS 84 formulas above, from latitude, longitude, and h |
The table is the article in miniature: name your z before you calculate anything. Most "my z is wrong" stories are really "my z is a different z" stories: an elevation fed into an XYZ slot, a graph height expected from a GIS layer, an ellipsoid height compared against a sea level map. The numbers are each correct in their own system and nonsense in each other's, exactly like the grid confusion in our coordinate system guide.
Z in the Wild: Where the Third Number Hides in Your Files
Once you know to look, z turns up everywhere in geographic files, wearing light disguises. A GPX track from a hike stores each point's elevation in an ele element, which is z in a trench coat, and fitness platforms graph it as your climb. GeoJSON coordinates come in pairs by default but accept a third number, and when they carry one it is elevation in meters, unless the file's author had other ideas, which is why reading a dataset's documentation beats assuming. Shapefiles can store Z values per vertex, and also M values, a fourth slot meaning "measure", often a distance along the feature or a time, which is not a coordinate at all and has confused everyone at least once. Elevation rasters are z industrialized: every cell of the grid holds a height, and the whole file is a surface of z values, the digital elevation models our elevation guide relies on. The practical habit across all of these: when software asks whether your data has z values, answer from the file's actual contents, not from hope, because a z invented by a default is worse than no z at all.
The Error Clinic: Four Ways Z Goes Wrong
The silent zero. A tool needs heights, finds none, and uses zero without telling you; your mountain dataset flattens to sea level and every slope, drainage, and visibility calculation downstream is fiction. Check the z range of any dataset before trusting an analysis: if minimum and maximum are both zero, you have a 2D dataset in a 3D costume.
The mixed reference. Elevations from the ellipsoid and from sea level differ by tens of meters, location dependent, and a dataset that merges two sources without reconciling them carries a step fault along the seam. Compare overlapping points whenever two height sources meet.
The swapped slot. In files that store several values per point, z can land in the M slot or vice versa, producing heights that are actually distances along a road. Heights in the thousands for a coastal town are the tell.
The unit split. Heights in feet from one source and meters from another differ by a factor of 3.28, small enough to pass a glance and large enough to ruin a design. A landscape whose mountains tripled between two files is a unit problem, never a geological event.
Each error has the same moral as the rest of this article: z is not one thing, and the professional move is always to ask which z, from which reference, in which unit, before calculating anything at all.
Related Guides
The closest companions to this guide are the coordinates guides below. Each one picks up a thread this page starts:
- How to Find the Coordinate System in AutoCAD: Drawing Settings, the CGEOCS Variable, and the Plain AutoCAD Catch: Whether an AutoCAD drawing has a coordinate system at all depends on which AutoCAD you are running.
- How to Find the Coordinate System in Civil 3D: MAPCSASSIGN, the Status Bar, and Drawing Settings: A Civil 3D drawing carries its coordinate system inside the file, and there are four places that will tell you what it is: the MAPCSASSIGN dialog,...
- How to Find a Coordinate Vector (Linear Algebra): The xB Method, Worked: Finding a coordinate vector means answering one question: what weights rebuild the given vector from the basis vectors? Set x equal to a...
Frequently Asked Questions
How do I calculate the z coordinate of a point on a plane?
If the plane is written as z in terms of x and y, substitute the known x and y. For z = 2x + 3y + 1 at (2, 1), z = 8. If the plane is in the general form ax + by + cz + d = 0, rearrange to isolate z: move the x, y, and constant terms to the other side and divide by c. For 2x + 3y + 6z = 12 at (1, 2), z = 0.667. Always substitute back to check.
What does the z coordinate mean in GIS?
Usually elevation: the height of the point above a reference surface, most often mean sea level. It is normally looked up from elevation data or measured, not calculated from x and y. Watch for two traps: heights measured from the ellipsoid differ from sea level heights by tens of meters, and a z of exactly 0 in a dataset usually means the data has no z at all.
What is the Z in XYZ (Earth centered) coordinates?
The distance from the equatorial plane toward the north pole, in a system centered on the Earth's center of mass. It is computed from latitude, longitude, and height with the WGS 84 formulas in this article. At the equator Z is 0; at the north pole Z is 6,356,752.3 meters; at the Statue of Liberty Z is 4,136,310.6 meters.
Why is my GPS altitude always less accurate than my position?
Because of satellite geometry: all satellites are above you, so the vertical direction is the worst observed direction in the system, and altitude inherits the largest errors. GPS altitude is also measured from the ellipsoid, not sea level, so it differs from mapped elevation by a location dependent amount even when the receiver is working perfectly.
Can z be negative?
Yes, in all three systems. In a 3D graph, points below the plane have negative z. In GIS, places below sea level, like Badwater Basin in Death Valley at minus 86 meters, have negative elevation. In Earth centered coordinates, the entire southern hemisphere has negative Z, since Z measures distance from the equatorial plane toward the north pole.
Do I need the z coordinate to find a location on a map?
For a flat map, no: latitude and longitude, or easting and northing, locate the point completely. Z becomes necessary when height matters: elevation profiles, 3D models, flight, drainage and flood analysis, or the Earth centered math GPS itself runs on. If your task never leaves the plane, two coordinates are the whole answer.
Photo credits: Ylanite Koppens (Pexels); Саша Алалыкин (Pexels). Photos are served from this site; follow the credit to the library page for the original.