Centroid Calculator
Enter triangle or polygon vertices to find the exact centroid coordinates, area, and median lengths.
🔷 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
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
💡 Example Calculations
Example 1 - Triangle with a Known Centroid
Triangle with vertices (0, 0), (9, 0), (3, 6)
Example 2 - L-Shaped Region (Concave Polygon)
L-shape with six vertices: (0,0), (4,0), (4,2), (2,2), (2,5), (0,5)
Example 3 - Equilateral Triangle Centroid Verification
Equilateral triangle with base on x-axis: (0,0), (6,0), (3, 5.196)
❓ Frequently Asked Questions
🔗 Related Calculators
How do you find the centroid of a triangle from its vertices?
The centroid of a triangle with vertices (x1,y1), (x2,y2), (x3,y3) is the average of the coordinates: Cx = (x1+x2+x3)/3, Cy = (y1+y2+y3)/3. This point is the intersection of the three medians. For example, triangle (0,0), (6,0), (3,4) has centroid (3, 1.333).
What is the centroid of a polygon and how is it calculated?
The centroid of a polygon is the area-weighted center of all its infinitesimal area elements. Unlike a triangle, you cannot simply average the vertex coordinates. The correct formula uses the Shoelace-based approach: Cx = (1/6A) times the sum of (xi+x(i+1)) times (xi*y(i+1) - x(i+1)*yi), where A is the signed area.
What is the difference between a centroid and a center of mass?
For a flat shape with uniform density, the centroid and center of mass are the same point. Center of mass applies more broadly: if density varies across the shape, the center of mass weights each region by its mass, while the geometric centroid always uses area as the weight. For uniform plates and laminas, the terms are interchangeable.
Does the centroid always lie inside the polygon?
For convex polygons (including all triangles), yes. For concave polygons, the centroid can lie outside the polygon boundary. For example, a thin crescent or C-shaped region can have a centroid in the empty interior space. This calculator computes the correct centroid regardless of convexity.
What is a median of a triangle?
A median connects a vertex to the midpoint of the opposite side. Every triangle has three medians and they all intersect at a single point: the centroid. The centroid divides each median in a 2:1 ratio from vertex to midpoint. This calculator shows all three median lengths in Triangle mode.
Can I use this calculator for the centroid of a rectangle or square?
Yes. Enter the four corner vertices in order as a polygon. The result will match the expected geometric center. For a rectangle with corners (0,0), (4,0), (4,3), (0,3), the centroid is (2, 1.5), the exact midpoint of diagonals.
How does the centroid relate to the center of gravity in engineering?
In structural engineering, the centroid of a cross-section (beam, column, slab) determines where the neutral axis lies. The neutral axis is where bending stress is zero. Finding the centroid of composite cross-sections (L-shapes, T-shapes) is a standard step in calculating bending moment of inertia, which determines how a beam resists bending.
What is the formula for the centroid of a polygon with more than 3 vertices?
For a polygon with n vertices in order: A = (1/2) times |sum of (xi*y(i+1) - x(i+1)*yi)|. Then Cx = (1/6A) times sum of (xi+x(i+1)) times (xi*y(i+1)-x(i+1)*yi), and similarly for Cy. This reduces to the triangle vertex-average formula when n=3. This calculator uses this exact formula for the Polygon mode.
How is the centroid different from the circumcenter or incenter of a triangle?
The centroid is the intersection of medians (average of vertices). The circumcenter is equidistant from all three vertices (center of the circumscribed circle). The incenter is equidistant from all three sides (center of the inscribed circle). All three are the same point only for equilateral triangles.
Why do I need to enter vertices in order for the polygon centroid?
The polygon centroid formula treats the vertices as defining a boundary traced in sequence. If you skip around (e.g., entering the vertices in a random order), the formula traces a self-intersecting star shape rather than the polygon you intended, giving a wrong centroid. Always enter vertices as you would walk around the perimeter.