How to Calculate the Centroid

In this post we will explore the centroid, it will be full of information in text, equations and pictorial forms with examples that are solved step by step to help you understand and apply equations to calculate the centroid of a shape and the first moment of area and most importantly, why we need too!

What is the Centroid?

To put it very simply, the centroid is the centre of a shape, such as in a 2x2 square, the centroid of the co-ordinates would be (1, 1). For a shape such as a square it is very easy to find the centroid with simple mathematics, or just through looking at it. However, when we have composite shapes, (two shapes together), or even just more complex shapes in general, the easiest, fastest and most efficient way to calculate the centroid is using an equation.

Being able to calculate the centroid is extremely important for the structural analysis of members, it is involved in the various calculations for different section properties, thankfully, it is really easy to calculate!

How Do We Calculate the Centroid?

The formula for the centroid is given below, don’t worry if it looks overly complicated, following a breakdown of the variables will we go through a very basic example and it will all make sense. Then we will look at more complex composite shape, after which you will be finding centroids of shapes in your sleep!

Centroid Formula

X̄*A = ∑(Xi*Ai)


ȳ*A = ∑(Yi*Ai)

Here is the breakdown of the variables in the equation for the X-Axis centroid,  
X̄ = The location of the centroid in the X Axis
A = The total area of all the shapes
Xi = The distance from the datum or reference axis to the centre of the shape i
Ai = The area of shape i.

Lets Find the Centroid - Ex. 1

Below is a rectangle, our aim, to find the co-ordinates of the centroid. To help follow through the example the datum or reference axis (Xo & Yo) is put onto the drawing and therefore we should have the same Xi and Yi values.

Centroid Shape - Example 1

Centroid Shape - Ex. 1

First thing to note in the example is there is only one shape, we will call this shape 1. To solve the centroid we look at each axis separately, the answers to each provide the co-ordinates (Xi, Yi). Units are not relevant for the centroid.


X̄*A = X1*A1

So we break down the variables and calculate them step by step.

X̄ = Coordinate Location (Our Answer!) 
A  = 5 * 2 = 10
X1 = 2 / 2 = 1
A1 = 5 * 2 = 10

Putting it altogether..

X̄ * 10 = 1 * 10
X̄ = 1


ȳ * A = y1 * A1

ȳ = Coordinate Location (Our Answer!) 
A  = 5 * 2 = 10
y1 = 5 / 2 = 2.5
A1 = 5 * 2 = 10

Putting it all together..

ȳ * 10 = 2.5 * 10
ȳ = 2.5

Below is the solution, shown graphically with the co-ordinates (X̄  ,ȳ)   of the centroid of the 5x2 rectangle. Simple right? Now lets try a composite shape, which is slightly more complicated.

Centroid Solution - Example 1

Ex.1 Solution

Complex Centroid - Ex.2

Below is a composite shape made up of a square and a rectangle, our aim, to find the co-ordinates of the centroid. Once again to help you follow through the example, the datum or reference axis (Xo & Yo) is put onto the drawing and therefore we should have the same Xi and Yi values.

Centroid Composite Shape - Example 2

Composite Shape Centroid Example

With composite shapes, we need to split the shape into individual shapes (sub-shapes, if you like). From this we can then apply the formulas as above to calculate X-bar and Y-bar for the co-ordinates of the centroid. We need to ensure that the distance from the datum to the centre of the shape runs through all of the composite shape. In this example, we need to split the shape in two different ways. It may sound confusing but with a few pictures it’ll be clear as rain.


Lets tackle the X axis first. To split it into sub-shapes and ensure that the Xi line follows through both, the solution is given below.

Composite shape made into two sub-shapes. Example 2

Ex.2 - X Axis Subshapes

To make it clearer which to solve for, using the equations, below is the shapes separated. As you become more comfortable, you can do this mentally.

Individual Shapes - Example 2

Ex.2 - X-Axis Shapes

Now using the original equation, we can split Xi and Ai according to both shapes, this lets us calculate the area of each shape (A1 and A2). Remember A in the first part of the equation for the whole composite shape!

To calculate X1 and X2 we have to look at the whole shape, as this is the distance between the centroid of A1 or A2 and the datum that we set, X0. See below.

Calculation X1 and X2 - Example 2

Ex.2 - X-Axis Distance to Datum

X̄*A = ∑(Xi*Ai)


X̄*A = (X1 * A2) + (X2 * A2)

X̄ =  Coordinate Location (Our Answer!) 
A  = (1 * 1) + (3 * 1) = 4
X1 = 1 / 2 = 0.5
A1 = 1
X2 = 1+ (1/ 2) = 1.5
A2 = 1 * 3 = 3

X̄ * 4 = 0.5 * 1  + 1.5 * 3
X̄ = 1.25


Now we tackle the Y-Axis, to do this we need to split the shape up into different sub-shapes to have a continuous axis running through the whole shape. 

Ex.2 - Y Axis Subshapes

Now repeating the same method as completed for the X-axis, we can break the shapes apart to calculate the area. 

Ex.2 - X-Axis Shapes

Before going ahead, see if you can calculate Y1 and Y2 for both shapes.

Calculation Y1 and Y2 - Example 2

Ex.2 - Y-Axis Distance to Datum

ȳ =  Coordinate Location (Our Answer!)
A  = (1 * 2) + (2 * 1) = 4
Y1 = 1 / 2 = 0.5
A1 = 1 * 2 = 2
Y2 = 1+ (2 / 2) = 2
A2 = 1 * 2 = 2

ȳ * 4 = (0.5 * 2) + (2 * 2)
ȳ = 1.25

Putting both X-bar and Y-bar together, we get the co-ordinates of (1.25, 1.25) for the centroid of the composite shape.

Centroid Solution - Example 2

Ex.2 Solution

Video Example

So, this concludes the end of the tutorial on how to calculate the centroid of any shape. You will find out how useful and powerful knowing how to calculate the centroid can be, in particular when assessing the shear capacity of an object using the first moment of area.

I hope you found this post useful, if you have any other questions please leave a comment. Further more, if you have any questions about this site, or in general, please get in touch using the facebook page.