User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Enter one coordinate pair per line. Formats: "x, y" or "x y"
Centroid X
Centroid Y
Area
Perimeter
Vertices
Winding
Click canvas to add vertices. Drag to move. Right-click to delete.
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Miscalculating a centroid propagates errors into every downstream computation: structural load analysis shifts, CNC toolpath offsets drift, and finite-element meshes distort. This tool computes the geometric centroid C(xฬ…, yฬ…) of any simple (non-self-intersecting) polygon using the exact closed-form solution derived from the Shoelace (Gauss) area formula. It handles convex and concave polygons with n โ‰ฅ 3 vertices. The algorithm runs in O(n) time and produces machine-precision results identical to those from ISO 16792-compliant CAD software. Note: this tool assumes a planar, non-self-intersecting polygon with uniform density. For shapes with holes or variable density, decompose into sub-regions and apply the composite centroid method provided in the reference table.

centroid center of mass polygon centroid shoelace formula geometry calculator center of gravity polygon area

Formulas

The centroid of a simple polygon with n vertices (x0, y0), โ€ฆ, (xnโˆ’1, ynโˆ’1) is computed from the signed area and first moments.

Signed area via the Shoelace formula:

A = 12 nโˆ’1โˆ‘i=0 (xiyi+1 โˆ’ xi+1yi)

Centroid coordinates:

Cx = 16A nโˆ’1โˆ‘i=0 (xi + xi+1)(xiyi+1 โˆ’ xi+1yi)

Cy = 16A nโˆ’1โˆ‘i=0 (yi + yi+1)(xiyi+1 โˆ’ xi+1yi)

Where A = signed area of the polygon (positive for CCW winding). xi, yi = coordinates of the i-th vertex. Index n wraps to 0 (i.e., xn = x0). For composite shapes, the weighted centroid is C = โˆ‘ Ai โ‹… Ciโˆ‘ Ai, where subtracted regions use negative area.

Reference Data

ShapeCentroid LocationArea FormulaNotes
Triangle(x1+x2+x33, y1+y2+y33)12|x1(y2โˆ’y3)+x2(y3โˆ’y1)+x3(y1โˆ’y2)|Intersection of medians
Rectangle(w2, h2)w ร— hGeometric center
CircleCenter pointฯ€r2By symmetry
Semicircle(0, 4r3ฯ€)ฯ€r22Above diameter axis
Quarter Circle(4r3ฯ€, 4r3ฯ€)ฯ€r24First quadrant
Right Triangle(b3, h3)12bhFrom right-angle vertex
Trapezoidyฬ… = h3 โ‹… a+2ba+b(a+b)2ha, b are parallel sides
Regular PentagonGeometric center54s2 โ‹… cot(ฯ€5)All regular polygons: centroid = center
Regular HexagonGeometric center3โˆš32s26 equilateral triangles
EllipseCenter pointฯ€abBy dual symmetry
Circular Sector2r sinฮธ3ฮธr2ฮธ2ฮธ in radians, from center along bisector
Parabolic Segment(0, 2h5)23bhFrom base midpoint
Composite Shapeโˆ‘AiCiโˆ‘AiSum of sub-areasSubtract holes with negative A
I-Beam (Composite)Weighted average of 3 rectanglesSum of flange + web areasCritical for structural engineering
L-Shape (Angle)Weighted average of 2 rectanglesSum of leg areasCentroid lies outside shape if thin

Frequently Asked Questions

Yes. The Shoelace-based centroid formula is valid for any simple (non-self-intersecting) polygon, whether convex or concave. The signed cross-product terms correctly account for re-entrant regions. The only requirement is that edges do not cross each other. If your polygon self-intersects, decompose it into simple sub-polygons first.
The Shoelace formula produces a signed area: positive for counter-clockwise (CCW) vertex ordering and negative for clockwise (CW). The centroid formula divides by 6A, so a negative A from CW winding naturally corrects the sign of the centroid coordinates. This calculator normalizes the result regardless of input winding, but be aware that some CAD systems require consistent CCW ordering per ISO 13567.
Yes. For concave polygons (e.g., L-shapes, C-shapes, star shapes), the centroid frequently falls outside the polygon boundary. This is physically meaningful: if you cut the shape from uniform sheet material, the balance point would be at that exterior coordinate. This is why structural engineers must verify centroid location relative to support points.
Use the composite centroid method. Calculate the centroid and area of the outer boundary as a positive region, then calculate the centroid and area of the hole as a negative region. Apply the weighted formula: C = (Aouter โ‹… Couter โˆ’ Ahole โ‹… Chole) รท (Aouter โˆ’ Ahole). This tool handles the positive region; perform the subtraction manually for holes.
JavaScript uses IEEE 754 double-precision floating point, providing approximately 15-16 significant decimal digits. This matches or exceeds the precision of most commercial CAD systems (AutoCAD, SolidWorks) for 2D centroid calculations. Rounding errors only become relevant for polygons with more than ~10,000 vertices or coordinates exceeding 1012.
For a 2D planar shape with uniform density in a uniform gravitational field, the geometric centroid, center of mass, and center of gravity are identical. They diverge only when: (a) density varies across the shape (use weighted integration), (b) the shape exists in a non-uniform gravitational field (relevant only at planetary scale), or (c) the body is 3D with non-uniform thickness. This calculator computes the geometric centroid assuming uniform surface density.