Polygon Centroid Calculator

Enter the vertices of a polygon to find its centroid — the exact center of mass of the shape.

How it is calculated

Type the vertices as x,y pairs separated by semicolons, in order around the boundary (clockwise or counter-clockwise both work). For each edge from vertex i to the next, with the last joining back to the first, the tool forms cross = xi·yi+1 − xi+1·yi. The signed area is A = ½ Σ cross, and the centroid is Cx = Σ (xi + xi+1) × cross / (6A), with the same form for Cy. At least three vertices are needed; a repeated closing vertex is harmless. If any pair is not two numbers, or the area is zero (collinear points), there is no result. Edges must not cross each other: the tool does not check this and gives a number even for a bow-tie, but it is meaningless.

Worked example

An L-shaped plot has vertices 0,0; 6,0; 6,2; 2,2; 2,6; 0,6. Check by splitting it into a 6 × 2 rectangle (area 12, centre (3, 1)) and a 2 × 4 rectangle above it (area 8, centre (1, 4)). Weighted by area: x = (12 × 3 + 8 × 1) / 20 = 2.2, and y = (12 × 1 + 8 × 4) / 20 = 2.2. The tool, using the shoelace sums, prints 2.2000 for X and 2.2000 for Y. Note that the plain average of the six corners would be a different point.

Try this example →

Common mistakes

  • Listing the vertices in the wrong order, for example jumping across the shape. The points must follow the boundary, or the edges cross and the result is meaningless.
  • Separating coordinates with a space or a semicolon inside a pair. The format is x,y; x,y, with a comma inside each pair and a semicolon between pairs.
  • Averaging the vertex coordinates instead. That only equals the centroid for symmetric shapes such as rectangles and regular polygons.
  • Expecting the centroid to be inside every polygon. For a strongly concave shape such as a C or a U, the centroid can lie outside the polygon.
  • Entering points along one straight line, which has zero area and gives no result.

About this calculator

The centroid of a simple polygon is its geometric center of mass, the average position of all the points inside its boundary assuming uniform density, and it is not generally the same point as the average of its vertex coordinates except for special shapes like regular polygons. This calculator finds it using the shoelace formula approach: the polygon's signed area and centroid coordinates are computed from a sum over consecutive vertex pairs, weighting each edge's contribution by the cross product of its endpoint coordinates.

CAD and GIS software use this exact method internally whenever a user draws an irregular polygon and asks for its center point, structural and mechanical engineers use it to locate the center of mass of a cross-section for load and stress calculations, and computer graphics engines use it for placing labels or pivot points on arbitrary polygon shapes.

Vertices need to be listed in order around the polygon for the centroid to come out right.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators