# Percent composition calculator

### What is Percent Composition? How to Calculate it in HTML Code

Percent composition represents the percentage of each element in a compound's total mass. It is calculated by dividing the total mass of an element in a compound by the total mass of the compound and multiplying by 100.

For example, let's say we have a compound with the chemical formula H2O. To calculate the percent composition of hydrogen, we need to first find the total mass of hydrogen in the compound. Since there are two hydrogen atoms in H2O, we can multiply the atomic mass of hydrogen (1.008 g/mol) by 2 to get the total mass of hydrogen in the compound, which is 2.016 g/mol. Similarly, we can find the total mass of oxygen in the compound by multiplying the atomic mass of oxygen (15.999 g/mol) by 1, which gives us 15.999 g/mol.

Next, we can calculate the total mass of the compound by adding up the masses of each element. In this case, the total mass of H2O is 2.016 g/mol + 15.999 g/mol = 18.015 g/mol.

Finally, we can calculate the percent composition of hydrogen by dividing the total mass of hydrogen (2.016 g/mol) by the total mass of the compound (18.015 g/mol) and multiplying by 100. This gives us a percent composition of hydrogen of approximately 11.19%.