Centroid Calculator
Find the geographic centroid of any number of latitude/longitude points. Paste one lat, lng pair per line and get the centre of gravity plus the bounding box. Free, runs in your browser.
lat, lng per line)
Why average X/Y/Z instead of lat/lng?
Naively averaging latitudes and longitudes gives wrong answers for points spread across a hemisphere (e.g. averaging New York and Tokyo does not land in the middle of the Pacific as you might expect). The robust method projects each point to a 3D vector on the unit sphere, averages the vectors, and converts the resulting vector back to lat/long. This is the same approach Turf.js uses for turf.centerOfMass.
Frequently Asked Questions
How is the centroid of lat/long points calculated?
For points that span a small area you can average latitudes and longitudes directly. For larger areas this breaks down because the Earth is a sphere, so this tool converts each point to 3D Cartesian coordinates (X, Y, Z on a unit sphere), averages those, and converts the average back to lat/long. This is the geometric centroid of the points projected onto the sphere.
What is the difference between centroid and midpoint?
A midpoint is the halfway point between exactly two coordinates. A centroid generalizes this to any number of points — the "centre of gravity" of the set. For two points, the centroid and the great-circle midpoint are the same.
What is the bounding box of my points?
Alongside the centroid, this tool returns the bounding box (min/max lat and lng) of all your points — useful for setting the initial view of a map or filtering a spatial query.
How many points can I paste?
As many as your browser can hold — thousands is no problem. Enter one coordinate pair per line, in lat, lng decimal format. Whitespace, tabs and extra commas are tolerated.