Centroid Calculator

Enter triangle or polygon vertices to find the exact centroid coordinates, area, and median lengths.

๐Ÿ”ท Centroid Calculator

Enter the three vertices of your triangle.

Vertex 1
Vertex 2
Vertex 3

Enter vertices in order (clockwise or counter-clockwise). Leave rows blank to skip.

1
2
3
4
5
6
7
8
Centroid (Cx, Cy)
Area
Vertices Used
Median Lengths (V1 / V2 / V3)

๐Ÿ”ท What is a Centroid Calculator?

A centroid calculator finds the geometric center of a two-dimensional shape from its vertex coordinates. The centroid, often called the center of mass or center of gravity for a uniform flat plate, is the single point where the shape would balance perfectly on a pin. For a triangle with vertices (x1,y1), (x2,y2), (x3,y3), the centroid is simply the average of the three vertex coordinates. For polygons with four or more sides, a more involved area-weighted formula is required.

The centroid appears constantly in engineering and architecture. Structural engineers locate the centroid of beam cross-sections (rectangular, I-beam, T-beam, L-shaped) to find the neutral axis, which is the line where bending stress is zero. Civil engineers use centroids to determine the resultant force position in soil pressure diagrams. Mechanical engineers compute the centroid of composite plates when designing brackets and mounting flanges. In robotics and CNC machining, the centroid of a workpiece surface determines where to apply fixtures or clamps for balanced support during machining operations.

A common misconception is that the centroid is the same as the circumcenter (equidistant from all vertices) or the incenter (equidistant from all sides). For triangles, all three centers coincide only in equilateral triangles. For general polygons, only the centroid has the property of being the average of all area elements. Another misconception is that the centroid always lies inside the shape: for convex shapes it always does, but concave polygons (like L-shapes or C-shapes) can have their centroid in the empty region outside the boundary.

This calculator handles both triangles (the simple vertex-average formula) and polygons with up to eight vertices (the Shoelace-based area-weighted formula). For the triangle mode, it also shows the lengths of all three medians, since the centroid lies at the intersection of the medians at the 2:1 ratio point.

๐Ÿ“ Formula

Triangle: Cx  =  (x1+x2+x3) ÷ 3   |   Cy  =  (y1+y2+y3) ÷ 3
(xi, yi) = coordinates of vertex i
Example: Triangle (0,0), (6,0), (3,4): Cx = (0+6+3)/3 = 3, Cy = (0+0+4)/3 = 1.333
Polygon: Cx  =  1÷(6A) × ∑(xi+xi+1)(xiyi+1−xi+1yi)
A = signed area from the Shoelace formula (may be negative for clockwise vertices)
n = number of vertices; indices are cyclic (vertex n wraps to vertex 0)
Cy = same formula replacing x terms with y terms in the first factor
Example: Rectangle (0,0), (4,0), (4,3), (0,3): Cx = 2, Cy = 1.5 (the geometric center)

The triangle formula is a special case of the polygon formula when n = 3. For n = 3, the area-weighted formula simplifies algebraically to the vertex average (x1+x2+x3)/3. For all other n, the area-weighted formula must be used, since simply averaging vertex x-coordinates gives a different (incorrect) result for polygons with unequal side lengths.

๐Ÿ“– How to Use This Calculator

Steps

1
Choose Triangle or Polygon mode - Click the Triangle tab to find the centroid of a triangle from three vertices, or the Polygon tab for any shape with four to eight vertices.
2
Enter vertex coordinates - Type the X and Y coordinates of each vertex in order, either all clockwise or all counter-clockwise. For the Polygon mode, leave unused rows blank.
3
Click Calculate - Press Calculate to see the centroid (Cx, Cy), the polygon area, and (in Triangle mode) the lengths of all three medians.
4
Verify the result - Check that the centroid coordinates fall inside your shape. If they appear outside, verify that your vertices are entered in consistent order with no self-intersections.

๐Ÿ’ก Example Calculations

Example 1 - Triangle with a Known Centroid

Triangle with vertices (0, 0), (9, 0), (3, 6)

1
Centroid formula: Cx = (0 + 9 + 3) / 3 = 12 / 3 = 4. Cy = (0 + 0 + 6) / 3 = 6 / 3 = 2.
2
Area via Shoelace: |0(0-6) + 9(6-0) + 3(0-0)| / 2 = |0 + 54 + 0| / 2 = 27 sq units.
3
Median from V1 (0,0) to midpoint of V2-V3 (6,3): length = sqrt((6-0)^2 + (3-0)^2) = sqrt(36+9) = sqrt(45) = 6.708 units.
Centroid = (4, 2), Area = 27 sq units
Try this example →

Example 2 - L-Shaped Region (Concave Polygon)

L-shape with six vertices: (0,0), (4,0), (4,2), (2,2), (2,5), (0,5)

1
This can be split into two rectangles: bottom 4x2 (area 8, centroid (2,1)) and left 2x3 (area 6, centroid (1,3.5)).
2
Composite centroid: Cx = (8*2 + 6*1) / (8+6) = (16+6)/14 = 22/14 = 1.571. Cy = (8*1 + 6*3.5)/14 = (8+21)/14 = 29/14 = 2.071.
3
Verify using the polygon formula with the 6 vertices in counter-clockwise order: (0,0), (4,0), (4,2), (2,2), (2,5), (0,5). The polygon formula gives the same answer.
Centroid = (1.571, 2.071), Area = 14 sq units
Try this example →

Example 3 - Equilateral Triangle Centroid Verification

Equilateral triangle with base on x-axis: (0,0), (6,0), (3, 5.196)

1
Centroid by vertex average: Cx = (0+6+3)/3 = 3. Cy = (0+0+5.196)/3 = 1.732 (= side times sqrt(3)/6 = 6 times 1.732/6 = 1.732).
2
For an equilateral triangle, the centroid, circumcenter, incenter, and orthocenter all coincide at the same point. The height h = 6 times sqrt(3)/2 = 5.196. The centroid is at h/3 = 1.732 from the base.
3
All three medians have equal length: m = sqrt((3-0)^2 + (5.196-0)^2) = sqrt(9 + 26.999) = sqrt(36) = 6 ... wait that's the side. Median = sqrt(3^2 + (5.196/2)^2) = ... from (0,0) to midpoint of V2-V3 = (4.5, 2.598): m = sqrt(4.5^2 + 2.598^2) = sqrt(20.25 + 6.75) = sqrt(27) = 5.196 units.
Centroid = (3, 1.732), All medians = 5.196 units
Try this example →

โ“ Frequently Asked Questions

How do you find the centroid of a triangle from its coordinates?+
The centroid of a triangle with vertices (x1,y1), (x2,y2), and (x3,y3) is at ((x1+x2+x3)/3, (y1+y2+y3)/3). This is the arithmetic mean (average) of the three vertex coordinates. It is the only triangle center defined as a simple average of vertices. For example, for (0,0), (6,0), and (3,4), the centroid is (3, 1.333).
What formula gives the centroid of a polygon with more than 3 vertices?+
For a polygon with n vertices, first compute the signed area A using the Shoelace formula: A = (1/2) times the sum of (xi times y(i+1) minus x(i+1) times yi). Then Cx = (1/(6A)) times the sum of (xi + x(i+1)) times (xi times y(i+1) minus x(i+1) times yi). The formula for Cy is analogous. Simply averaging the vertex coordinates does not give the correct centroid for irregular polygons.
Is the centroid the same as the center of mass?+
For a flat plate with uniform (constant) density, yes. The centroid and center of mass are the same point. If density varies across the shape, the center of mass shifts toward the denser region while the geometric centroid stays fixed. This calculator computes the geometric centroid, which equals the center of mass only for uniform-density shapes.
Does the centroid always lie inside the shape?+
For convex shapes (triangle, rectangle, regular polygon), the centroid always lies inside. For concave shapes (L-shapes, U-shapes, C-shapes), the centroid can fall in the empty region outside the boundary. This is physically correct: think of a boomerang balanced on a point in empty space at its geometric center.
What is the 2:1 centroid theorem for triangles?+
The centroid divides each median in a 2:1 ratio measured from the vertex to the midpoint. The distance from a vertex to the centroid is two-thirds of the total median length. The distance from the centroid to the opposite midpoint is one-third of the median. This ratio holds for all three medians of any triangle, and the centroid is the unique point where all three medians intersect.
How do I find the centroid of a composite shape in engineering?+
Split the composite shape into simple sub-shapes (rectangles, triangles, circles). Find the area and centroid of each sub-shape separately. The composite centroid is the area-weighted average: Cx = sum(Ai times Cxi) divided by sum(Ai), and similarly for Cy. This calculator handles this directly if you can trace the full boundary as a polygon, which avoids the manual splitting step.
How is the centroid used in structural engineering?+
In beam design, the centroid of the cross-sectional area defines the neutral axis, the line where bending stress equals zero. The distance from the neutral axis to the extreme fibre is used to compute bending stress via the flexure formula: sigma = M times c divided by I, where I is the second moment of area about the centroidal axis. Finding the centroid is therefore the mandatory first step in any bending analysis.
What is the centroid of a circle or ellipse?+
The centroid of a full circle or ellipse is its geometric center, which is the midpoint of the bounding box. For a circle centred at (h, k), the centroid is (h, k). For a semicircle of radius r with the flat edge along the x-axis, the centroid is at (0, 4r/(3ฯ€)) โ‰ˆ (0, 0.4244r) above the diameter. These closed-form results can be derived using integral calculus.
Why should vertices be entered in order for the polygon centroid?+
The polygon centroid formula traces the boundary in sequence. Entering vertices out of order (e.g., entering opposite corners alternately) describes a self-intersecting star polygon, not the intended shape. The formula then computes the centroid of that star shape, which is a completely different answer. Always enter vertices as you would walk continuously around the perimeter in one direction.
How is the centroid different from the circumcenter of a triangle?+
The centroid is the intersection of the three medians, located at the average of the three vertices. The circumcenter is the point equidistant from all three vertices and is the center of the circumscribed circle. The incenter is equidistant from the three sides. These three centers only coincide for equilateral triangles. For right triangles, the circumcenter is at the midpoint of the hypotenuse, which is very different from the centroid.
Can I use this calculator to find the centroid of a rectangle?+
Yes. Switch to Polygon mode and enter the four corner vertices of the rectangle in order. The result will be the geometric center at ((x1+x3)/2, (y1+y3)/2), the intersection of the diagonals. For a rectangle with corners (0,0), (8,0), (8,5), (0,5), the centroid is (4, 2.5), confirming the result by symmetry.
What is the centroid of a right triangle with legs a and b?+
For a right triangle with the right angle at the origin and legs along the axes, with vertices at (0,0), (a,0), and (0,b), the centroid is at (a/3, b/3). This is one-third of the leg length from each axis. For example, a 3-4-5 right triangle with legs 3 and 4 has its centroid at (1, 1.333) if the right angle is at the origin.