Centroid Calculator
Enter the coordinates of your triangle vertices, polygon corners, or discrete points to find the centroid, the geometric center of the shape. Choose triangle mode for a classic three-vertex problem, polygon mode (up to 6 vertices) for any closed shape, or points mode for the center of mass of a set of unconnected points. Results update instantly and the steps panel shows the full working.
Formula
Worked example
Triangle with vertices A(0, 0), B(6, 0), C(3, 4): centroid x = (0+6+3)/3 = 3, centroid y = (0+0+4)/3 = 1.333. So the centroid is at G(3, 1.333). Area = |0*(0-4) + 6*(4-0) + 3*(0-0)| / 2 = |0 + 24 + 0| / 2 = 12 sq units.
What is the centroid of a shape?
The centroid is the geometric center of a shape, the point at which the shape would perfectly balance if it were made of a uniform, weightless material. In geometry it is defined as the arithmetic mean of all the points in the shape. For a triangle, the centroid is the intersection of the three medians, the lines from each vertex to the midpoint of the opposite side. For a uniform solid object the centroid coincides with the center of mass, which is why it is so important in engineering, physics, and structural design. Unlike the circumcenter or orthocenter, the centroid always lies inside the shape for any convex polygon.
How to calculate the centroid
For a triangle with vertices A(x1, y1), B(x2, y2) and C(x3, y3), the centroid is simply the average of the three vertex coordinates: G = ((x1+x2+x3)/3, (y1+y2+y3)/3). For any closed polygon with n vertices, the signed-area (shoelace) method gives a more accurate result because it weights each edge by its contribution to the enclosed area. The signed area is computed first as A = (1/2) * sum of (xi * y(i+1) - x(i+1) * yi). The centroid coordinates are then Cx = (1/(6A)) * sum of (xi + x(i+1)) * (xi * y(i+1) - x(i+1) * yi) and Cy is the same with y substituted. For a simple set of unconnected points, the centroid is just the arithmetic mean of the x-coordinates and y-coordinates separately.
Triangle centroid and the 2:1 median ratio
One of the most useful properties of the triangle centroid is that it lies exactly two-thirds of the way along each median, measured from the vertex. Equivalently, the centroid divides every median in a 2:1 ratio, with the longer segment being between the vertex and the centroid. This property can be used to verify any centroid calculation: draw or compute each median, check that all three meet at the same point, and confirm the 2:1 distance ratio. For right triangles with legs along the axes (base b, height h), the centroid simplifies to (b/3, h/3). For an equilateral triangle with side a and its base on the x-axis, the centroid is at (a/2, a*sqrt(3)/6).
Polygon centroid with the shoelace formula
The triangle average formula does not extend correctly to polygons with more than three vertices. For any closed, non-self-intersecting polygon you should use the shoelace (signed-area) method instead. The vertices must be listed in order, either all clockwise or all counterclockwise. If the order is mixed the formula returns the centroid of the net signed area, which may not match the visual center of the shape. A rectangle from (0,0) to (4,3) has its centroid at (2, 1.5) by symmetry, which the shoelace formula correctly returns. For a regular n-sided polygon centered at the origin, the centroid is always at the origin by symmetry, regardless of the number of sides.
Centroid formulas for common shapes
| Shape | Inputs needed | Centroid x | Centroid y |
|---|---|---|---|
| Triangle | Vertices (x1,y1), (x2,y2), (x3,y3) | (x1+x2+x3)/3 | (y1+y2+y3)/3 |
| Rectangle | Width w, height h (origin at corner) | w/2 | h/2 |
| Right triangle | Base b, height h (legs on axes) | b/3 | h/3 |
| Equilateral triangle | Side length a (base on x-axis) | a/2 | a*sqrt(3)/6 |
| Isosceles triangle | Base l, height h (symmetric about y-axis) | l/2 | h/3 |
| Trapezoid | Parallel sides a, b; height h | (complex formula) | h*(2b+a)/(3*(a+b)) |
| Regular n-gon | Inscribed in circle, centered at origin | 0 | 0 |
| Circle / ellipse | Centered at (a, b) | a | b |
| Set of n points | Coordinates (xi, yi) | sum(xi)/n | sum(yi)/n |
Quick-reference centroid coordinates for standard 2D shapes. Origin and orientation follow the conventions used in this calculator.
Frequently asked questions
What is the difference between the centroid and the center of mass?
For a flat (2D) object made of uniform material, they are the same point. The centroid is a purely geometric concept based on shape, while center of mass also depends on how mass is distributed. If the material is non-uniform, the center of mass can differ from the geometric centroid. This calculator finds the geometric centroid only.
Does the centroid always lie inside the shape?
For any convex shape (where no interior angle exceeds 180 degrees), yes: the centroid always lies inside. For concave (non-convex) shapes, however, the centroid can fall outside the boundary. A horseshoe shape is a common example where the geometric center falls in the air between the two arms.
Why does the polygon formula give a different answer than averaging the vertices?
Averaging the vertex coordinates only gives the correct centroid for a triangle. For a polygon with four or more vertices, that simple average is the centroid of the vertex points, not of the enclosed area. A long, thin rectangle with vertices at (0,0), (100,0), (100,1), (0,1) has its centroid at (50, 0.5), which the shoelace formula returns correctly. Averaging vertices gives (50, 0.5) here by luck of symmetry, but for an irregular polygon the vertex average can be far from the area centroid.
How do I find the centroid of a composite shape?
Divide the composite shape into simpler sub-shapes (triangles, rectangles, etc.), compute the centroid and area of each, then take the weighted average: total centroid x = sum(Ai * Cxi) / sum(Ai), and similarly for y. Holes are handled by subtracting their area and area-weighted centroid from the totals.
What are the units of the centroid coordinates?
The centroid coordinates are in the same units as your input coordinates. If you enter vertices in millimeters, the result is in millimeters. If you enter them as dimensionless numbers on a graph, the result is in those graph units. The area output is in the square of those units.
Can I use this for 3D shapes?
This calculator handles 2D shapes only. For a 3D solid you would need the x, y and z coordinates of all vertices and a volume-weighted version of the formula. For common 3D shapes such as a sphere, cylinder or rectangular prism the centroid coincides with the geometric center by symmetry.