What is percent yield?
In chemistry, percentage yield is the ratio of the actual yield to the theoretical yield multiplied by 100.
Theoretical yield is the yield that is calculated mathematically. All conditions of an experiment are assumed to be optimum. It is mostly higher than the actual yield because an experiment is never ideal.
The actual yield is calculated from the readings of an experiment.
Why is percent yield less than 100%?
Due to loss and gain of heat subject to the environment, atmospheric pressure and humidity, incomplete reactions and loss of sample during an experiment, the actual yield is usually less than the theoretical yield. This is why the percent yield is less than 100%.
In rare cases, the percent yield may be more than 100%. In these cases, the recovered sample is more than that is calculated theoretically.
If the actual and theoretical yields are same, the ratio will be 1:1 and hence, the percent yield will be 100%.
The higher the percent yield, the better the results of an experiment.
What is the formula to calculate percent yield?
Percent yield = (Actual yield/Theoretical yield) x 100
Where,

Actual yield is the amount of product obtained from a chemical reaction via an experiment.

Theoretical yield is the amount of product obtained mathematically from the stoichiometric or balanced equation.
Note that the units for both the actual and theoretical yield need to be the same, that is, moles or grams.
How to calculate percent Yield?
1. Construct a chemical equation and balance it.
2. Find the limiting reagent
In a chemical reaction, the compound that determines the amount of product made is the limiting reagent.
Other molecules or compounds are in excess. For example, you have a bag of green and red skittles and you have to pair them up. There are 14 green skittles (reactant) and 10 Red skittles (reactant). When you are done pairing them, you will have 10 pairs of red and green skittles (product) and you’ll be left with 4 green skittles which were in excess. Therefore, the red skittles (limiting reagent) determined how many pairs you could make.
There are multiple methods to determine the limiting reagent. Following is one of them:

Calculate the actual ratio of the reactants using the mass of the reactants you are using to conduct the experiment. Find the moles using the formula =

Moles= mass/Atomic mass or molecular mass.

Find the mole ratio. For example reactant X/reactant Y.

Using the balanced chemical equation, find another ratio of the reactants using the number prefixes. For example reactant X/reactant Y.

Compare the actual ratio to the stoichiometric ratio.

If the actual ratio is greater than the stoichiometric ratio, then reactant Y is the limiting reagent. And vice versa.
3. Calculate the theoretical yield
Use the limiting reagent and stoichiometric ratios to calculate the theoretical yield. For example we actually have 0.2 moles of the limiting reagent Y for a chemical equation:
2X + 3Y = 2Z
To calculate the theoretical yield:
0.2 moles of Y × (2 mol of Z)/(3 mol of Y)
=0.13mol of Z should be produced theoretically.
You can convert the yield in moles to grams or centimeter cube depending on the apparatus you will use to calculate the mass or volume of the product during the experiment.
4. Calculate the percent yield
After the completion of your experiment, calculate the mass/moles of your product and compare it with your theoretical results using the percent yield formula.
Example Questions
Q.1. For the following reaction, what is the limiting reagent if we start with 2.0g Al and 4.0g of 〖Cl〗_2?
2Al(s) + 3Cl2(g) → 2AlCl3(s)
Answer:
 Convert to moles
Moles= mass/Atomic mass or molecular mass.
Moles of Al = 2/26.98
= 0.0740mol
Moles of Cl_2 = 4/70.9
= 0.056mol  Find limiting reagent
Actual ratio=moles of Al/moles of Cl2
= 0.074/0.056
=1.32
Stoichiometric ratio= 2mol of Al/3mol of Cl2
= 0.67
This means you need at least 0.67 moles of Al for every mole of Cl2. Since your actual ratio is greater than the stoichiometric ratio, there is more Al than you need to react with each mole of Cl2.Therefore Cl2 is the limiting reagent and Al is in excess.  Calculate theoretical yield
= 0.056mol of Cl2 × (2 mol of AlCl3)/(3 mol of Cl2)
= 0.037mol of AlCl3  Convert moles into grams
Mass = mole × Atomic mass/ molecular mass
= 0.037 × 133.33
=4.97g of AlCl3  Find the actual yield
 Calculate the percent yield using the formula =
Percent yield = (Actual yield/Theoretical yield) x 100
Q.2. The decomposition of magnesium carbonate forms 10 grams of magnesium oxide in an experiment. The theoretical yield is known to be 15 grams. What is the percent yield of magnesium oxide?
MgCO3 → MgO + CO2
Answer: Calculate the percent yield using the formula =
Percent yield = (Actual yield/Theoretical yield) x 100
= 10/15 × 100
= 66.67%