Centroid Calculator
Find the centroid (x̄, ȳ) for common 2D shapes. Choose a shape mode, enter dimensions, and get the centroid relative to the shown datum.
Calculation Steps
Practical Guide
Centroid Calculator: Find \((\bar{x}, \bar{y})\) for Common and Composite Shapes
This guide shows how to use the Centroid Calculator correctly, what assumptions it makes, and how to sanity-check results for standard shapes and composite areas—exactly the way centroid problems show up in real structural and mechanical design.
Quick Start
- 1 Decide if your problem is a single shape (rectangle, triangle, circle, trapezoid, etc.) or a composite area made of multiple parts and/or holes.
- 2 Set a clear origin and coordinate axes. Most centroid errors come from inconsistent reference points. The calculator assumes all inputs are measured from the same origin.
- 3 For a single shape, pick the shape type (Mode) and enter the required dimensions. Unused fields hide automatically.
- 4 For a composite section, enter each part’s area \(A_i\) and its centroid location \((x_i, y_i)\). Use negative area for holes/cutouts.
- 5 Choose output units and compute. The calculator returns the centroid \((\bar{x},\bar{y})\).
- 6 Run a quick sanity check: does \((\bar{x},\bar{y})\) lie in a reasonable location (often on symmetry axes)? If not, re-check your origin and signs.
Tip: Sketch the shape with dimensions and mark your origin before typing anything. A 15-second sketch prevents 15 minutes of debugging.
Warning: If you mix coordinate reference points between parts in a composite area, the weighted average will be wrong even if every part centroid is correct.
Choosing Your Method
Method A — Formula for a Single Shape
Use this when the cross-section is a single standard geometry with well-known centroid formulas.
- Fastest path from dimensions to \((\bar{x},\bar{y})\).
- Great for homework, quick checks, and early-stage design.
- Less setup—no need to compute intermediate areas or part centroids.
- Limited to common shapes (rectangles, triangles, circles, trapezoids, segments).
- Assumes uniform density/thickness in the plane.
Method B — Composite Area (Area-Weighted Average)
Use this for built-up sections: T-beams, L-angles, channels, plates with holes, or any shape you can split into simpler parts.
- Handles almost any geometry if you can partition it.
- Supports cutouts by using negative area.
- Aligns with how centroid is used in moment of inertia and bending stress.
- Requires careful bookkeeping of each part centroid.
- More prone to reference-axis mistakes.
Method C — Coordinate Integration (Advanced)
Used when the boundary is described by a function or curve and a closed-form centroid is needed.
- Exact for non-standard shapes (parabolas, splines, variable thickness).
- Matches finite-element or CAD derivations.
- More math; beyond most quick-design needs.
- Not necessary if you can decompose into parts.
The calculator primarily supports Method A and Method B, because they cover nearly all practical centroid lookups in statics, structural design, and machine components.
What Moves the Number the Most
Every \(x_i\) and \(y_i\) must be measured from the same origin. Shifting the origin shifts \((\bar{x},\bar{y})\) by the same amount.
The centroid pulls toward larger areas. Doubling a part’s area doubles its influence in \(\sum A_i x_i\) and \(\sum A_i y_i\).
A void subtracts area and “pushes” the centroid away from the cutout. Forgetting the minus sign is a classic failure mode.
If the shape is symmetric about an axis, the centroid lies on that axis. Any result off that line indicates a setup error.
Some shapes shift more with certain dimensions: e.g., a triangle’s centroid moves linearly with height but also depends on orientation.
For composites, different partitions should produce the same centroid if all \(A_i, x_i, y_i\) are consistent. Use this as a check.
Worked Examples
Example 1 — Single Right Triangle
- Shape: Right triangle with legs along axes
- Base: \(b = 300 \text{ mm}\)
- Height: \(h = 200 \text{ mm}\)
- Origin: At right-angle corner
For a right triangle with legs on the axes, the centroid is located one-third of the way from each leg:
\[ \bar{x}=\frac{b}{3},\qquad \bar{y}=\frac{h}{3} \]
Enter Mode = “Right Triangle,” then input base and height. The calculator should return approximately \((100, 66.7)\) mm. If you rotate the triangle, the centroid location relative to the origin changes—so be sure your origin matches the leg orientation.
Example 2 — Composite L-Section (Two Rectangles)
- Shape: L-section made from two rectangles
- Rect 1: \(200 \text{ mm} \times 20 \text{ mm}\) (horizontal flange)
- Rect 2: \(20 \text{ mm} \times 160 \text{ mm}\) (vertical web)
- Origin: Outer corner of the L (bottom-left)
- Overlap: The 20×20 corner is shared—count it only once by defining rectangles that don’t double-count.
Partition into two non-overlapping rectangles:
- Part A: Horizontal rectangle \(b=200\), \(h=20\). Area \(A_1=200\cdot20=4000\text{ mm}^2\). Centroid at \((x_1,y_1)=(100,10)\).
- Part B: Vertical rectangle \(b=20\), \(h=140\) stacked above the flange. Area \(A_2=20\cdot140=2800\text{ mm}^2\). Centroid at \((x_2,y_2)=(10,20+70)=(10,90)\).
\[ \bar{x}=\frac{A_1x_1+A_2x_2}{A_1+A_2},\qquad \bar{y}=\frac{A_1y_1+A_2y_2}{A_1+A_2} \]
In composite mode, enter \(A_1, x_1, y_1\) and \(A_2, x_2, y_2\). The centroid should fall inside the “knee” of the L, closer to the larger flange—exactly what \(\bar{x}\approx63\) mm and \(\bar{y}\approx43\) mm indicate.
Common Layouts & Variations
Centroid problems often repeat in a few standard configurations. This table summarizes practical patterns and how to treat them in the calculator.
| Configuration | How to Model | Use Cases | Notes / Pros & Cons |
|---|---|---|---|
| Plate with circular hole | Composite: outer plate (+), hole (−) | Bolted connections, access holes | Use negative area for hole; centroid shifts away from void. |
| T-beam section | Composite: flange (+) + web (+) | RC beams, steel shapes | Watch overlap—define parts so areas don’t double-count. |
| Channel / C-shape | Composite: three rectangles | Steel cold-formed members | Symmetry about one axis often gives one coordinate immediately. |
| Quarter/semicircle areas | Single shape mode | Fillets, curved brackets | Centroid is not at radius/2; use built-in formula. |
| Trapezoid plate | Single trapezoid or two triangles + rectangle | Earth pressure diagrams, tapered members | Either method works; results should match within rounding. |
- Label each part on your sketch with \(A_i, x_i, y_i\).
- Confirm sign convention for holes before computing.
- Exploit symmetry to reduce chances of mistakes.
- Partition without overlaps unless you intentionally correct for them.
- Check that \(\sum A_i\) is positive for solids.
- Keep units consistent across all parts.
Specs, Logistics & Sanity Checks
Assumptions
- Area is uniform in thickness and density (2D centroid).
- All coordinates are referenced to the same origin.
- Shapes are idealized (perfect lines/arcs).
Common Pitfalls
- Using midpoints instead of true part centroids.
- Forgetting to subtract holes (negative area).
- Mixing inches and feet (or mm and m) between parts.
- Double-counting overlapping regions.
Sanity Checks
- Centroid lies on symmetry axes.
- Centroid is within the convex hull of solid parts (unless holes dominate).
- Re-partitioning yields the same result.
- Coordinates fall within reasonable bounds of the geometry.
Engineering tip: If you’re using the centroid for moment of inertia or bending stress, keep the centroid coordinates to at least 3 significant figures before plugging into later steps.
Design note: For composite sections that will be fabricated, verify that real-world welds, fillets, or gussets don’t shift the centroid enough to matter for your load path.
