Centroid Calculator – Center of a Triangle, Polygon or Set of Points

Find the centroid, or balance point, of a polygon, a triangle or a set of points. Choose a mode, enter the coordinates, and the calculator returns the centroid x and y, plus the area for a polygon or the point count for an average.

Shape Calculators

Centroid Calculator (Center of a Shape)

Find the centre (centroid) of a triangle, a polygon from its corner coordinates, or the average point of a set of points.

Coordinates in
One corner per line as x, y — in order around the shape (clockwise or anticlockwise).
For a polygon the centroid is the balance point of its area, which is generally not the same as the average of its corner points (except for triangles).

The starting values are an L-shaped polygon with corners at (0, 0), (10, 0), (10, 4), (4, 4), (4, 10) and (0, 10). Enter the corners in order around the outline, or switch to the triangle or mean-of-points mode.

Three kinds of centre

People use the word centre for different things, so the calculator offers three modes:

  • Polygon: the centroid of the enclosed area, the point where a flat sheet of the same shape would balance.
  • Triangle: the centroid of a triangle, found from its three corners.
  • Mean of points: the plain average of x and the plain average of y for any list of points.

For a polygon, the area centroid is not the average of the corners. Only for a triangle do the two agree, and the next sections show the difference with numbers.

Centroid of a triangle

The centroid of a triangle is where its three medians meet, and each median is split 2 to 1 from the vertex. It is simply the average of the three corners.

Cx = (x1 + x2 + x3) / 3

Cy = (y1 + y2 + y3) / 3

Where x1, y1 to x3, y3 are the coordinates of the three corners. Using the starting triangle (0, 0), (6, 0) and (2, 6):

Cx = (0 + 6 + 2) / 3 = 2.667

Cy = (0 + 0 + 6) / 3 = 2

The centroid is at (2.667, 2), which sits one third of the way up from the base and inside the triangle.

Centroid of a polygon

For a polygon the calculator uses the area-weighted formulas built on the shoelace sum. Each pair of neighbouring points gives a cross product, and the cross products also add up to twice the area.

A = ½ × Σ (xi × yi+1 − xi+1 × yi)

Cx = Σ (xi + xi+1) × (xi × yi+1 − xi+1 × yi) / (6 × A)

Cy = Σ (yi + yi+1) × (xi × yi+1 − xi+1 × yi) / (6 × A)

Where xi, yi is a corner, xi+1, yi+1 is the next corner, and the last corner joins back to the first. The result does not depend on the starting corner or on clockwise versus anticlockwise order.

Worked example: the L-shape

The six cross products for the starting L-shape are 0, 40, 24, 24, 40 and 0, which add up to 128. The area is 128 / 2 = 64.

Weighted sum for x = 0 + 20 × 40 + 14 × 24 + 8 × 24 + 4 × 40 + 0 = 1488

Cx = 1488 / (6 × 64) = 1488 / 384 = 3.875

By the symmetry of this shape, Cy is also 3.875, so the centroid is at (3.875, 3.875).

You can confirm this by splitting the L into two rectangles. The lower bar is 10 by 4, with area 40 and centre (5, 2). The upright is 4 by 6, with area 24 and centre (2, 7). Then Cx = (40 × 5 + 24 × 2) / 64 = 3.875 and Cy = (40 × 2 + 24 × 7) / 64 = 3.875. Both methods agree.

Averaging the six corners instead gives (4.667, 4.667), which lies well away from the true balance point. That is why the polygon mode weights by area instead of averaging corners.

Mean of points

The mean mode treats every point equally and ignores any outline. It returns the average x, the average y and the number of points N.

Mean x = Σ x / N and Mean y = Σ y / N

For the starting points (1, 2), (4, 6), (7, 1) and (3, 3), the sum of x is 15 and the sum of y is 12, with N = 4. The mean is (3.75, 3). Use this for survey readings, sample locations or any scatter of equally weighted points, where no area is involved.

Tips for reliable results

  • List polygon corners in order around the edge, and do not repeat the first corner at the end.
  • Use one unit for every coordinate. The centroid is in that unit, and the area in its square.
  • The outline should not cross itself, because a crossing outline has no single balance point.
  • The centroid of a shape with a hole or a cut-out is found by treating the hole as negative area, which needs separate calculations.
  • The centroid of a thin uniform plate is its balance point. For a solid with uneven density, the centre of mass can differ.

The origin you choose does not change the shape, only the numbers. Moving every point by the same amount moves the centroid by the same amount.

Centroid of a composite shape

When a shape splits cleanly into simple pieces, you can also find the centroid by hand with weighted averages. For pieces of area A1, A2 and so on, with centroids (x1, y1), (x2, y2) and so on:

Cx = (sum of each piece area × its x) / (sum of the piece areas)

This is the method used to check the L-shape above. It is handy for a quick sanity check on any polygon result. For a plain rectangle with corners (0, 0), (8, 0), (8, 5) and (0, 5), the area is 40 and the centroid is the middle of the box, (4, 2.5), which the polygon mode reproduces.

Typical uses include finding where to support or lift a flat plate, locating the centre of a plot, marking the balance point of a cut-out template and positioning a label or marker in the middle of an irregular region. If the answer lands outside the shape, which can happen for a deeply curved outline, that is normal: the centroid does not have to lie inside a concave polygon.

Frequently asked questions

What is the centroid of a polygon?

It is the balance point of the enclosed area, found by weighting each edge by its cross product. It is not the average of the corner coordinates unless the shape is a triangle.

How do I find the centroid of a triangle?

Add the three x values and divide by 3, then add the three y values and divide by 3. The triangle (0, 0), (6, 0), (2, 6) has its centroid at (2.667, 2).

Why is the polygon centroid different from the average of the corners?

The corners ignore how the area is spread out. For the L-shape example the corner average is (4.667, 4.667), but the area centroid is (3.875, 3.875).

Which units does the calculator use?

Whatever unit your coordinates use. The centroid is in that unit and the polygon area is in its square, so feet in gives square feet out.

Mark Danny

Mark Danny

Mark Danny builds and maintains the free calculators and guides on Area of Irregular Shapes Calculator. Every calculator page explains its formula and shows a worked example, so you can check the working yourself. Spotted a mistake or have a suggestion? Email gulsher.hingoro101@gmail.com.

Articles: 559