Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Molar Mass Calculator (Molecular Weight)

Enter a chemical formula and press "Calculate". You get the molar mass (molecular weight), a breakdown by element (count, atomic weight, mass and mass percent) and a pie chart of the mass composition.

Element symbols are case-sensitive (for example, CO is carbon monoxide and Co is cobalt). You can use parentheses (), brackets [] and a dot for hydrates (for example, CuSO4.5H2O; a middle dot · also works). For ionic compounds that do not form molecules, such as NaCl, the correct name is "formula mass" rather than "molecular weight", but the calculation is the same, so this calculator works for them too.
Result and graph
Type a chemical formula (for example, H2O) in the field on the left and press "Calculate". The molar mass and the breakdown by element will appear here.

What you can do on this page

  • Just type a chemical formula (for example, \(\mathrm{H_2O}\) or \(\mathrm{Al_2(SO_4)_3}\)) to get the molar mass (molecular weight, g/mol) on the spot
  • A breakdown table by element (count, atomic weight, mass and mass percent) and a pie chart of the mass composition are shown at the same time
  • Nested parentheses () and brackets [] and hydrates written with a dot (for example, CuSO4.5H2O) are supported
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
The atomic weights are the abridged values from IUPAC (the International Union of Pure and Applied Chemistry). Element symbols are case-sensitive (CO is carbon monoxide, Co is cobalt).

What is this calculation used for?

Preparing reagents for experiments (deciding how many grams to weigh out)

To make 1 L of 0.1 mol/L salt water, the sodium chloride you need is molar mass (formula mass) 58.44 × 0.1 mol = about 5.84 g.
In chemistry, biology and pharmacy labs, every time you make a solution you convert "moles × molar mass = grams to weigh out", so the molar mass is a number used every day.

Drug development (a molecular weight guideline for drug candidates)

When choosing candidate molecules for a pill, the pharmaceutical industry often uses "molecular weight of 500 or less" as one guideline (Lipinski's rule of five; molecules that are too large are harder for the body to absorb).
For researchers narrowing down new drug candidates, the molecular weight is one of the first basic numbers they check.

Fertilizer calculations (how much nitrogen it contains)

Urea \(\mathrm{CH_4N_2O}\) (molecular weight 60.056), a common nitrogen fertilizer, is \(28.014 \div 60.056 \times 100 \approx 46.6\%\) nitrogen by mass. The "46-0-0" (46% nitrogen) printed on a bag of urea comes from exactly this calculation.
When farmers and gardeners work out how much fertilizer they need to put a certain amount of nitrogen on a field, the mass percent formula is the foundation.

Converting blood sugar units (reading lab results)

In the US, blood sugar is reported in mg/dL, while many other countries and many research papers use mmol/L. The conversion uses the molecular weight of glucose \(\mathrm{C_6H_{12}O_6}\), 180.156: the factor 18 in "mg/dL ÷ 18 ≈ mmol/L" comes from it (180.156 ÷ 10 ≈ 18).
It is an example of molecular weight working behind the scenes when lab values are compared between countries or when a meter switches its display units.

Calculating CO₂ emissions (why carbon becomes 3.67 times heavier)

The environmental conversion factor "burning 1 ton of carbon gives about 3.67 tons of CO₂" comes from the molecular weight of \(\mathrm{CO_2}\), 44.009, divided by the atomic weight of carbon, 12.011, which is about 3.664. The mass goes up because oxygen joins the carbon as it burns.
This idea is used in company greenhouse gas reports and in carbon footprint calculations.

Formulas and figures

Molar mass (molecular weight)
Figure
Standard notation (the usual math form)
\(M\) \(=\) \(\sum_{i}\) \(w_i\) \(\times\) \(n_i\)
In words (symbols replaced with words)
④ \(M\): molar mass \(=\) ③ \(\sum\): add over all elements ① \(w_i\): atomic weight of the element \(\times\) ② \(n_i\): number of atoms of the element
The formula in words
① Take the \(w_i\): atomic weight of the element
② multiply it by the \(n_i\): number of atoms of that element in the formula to get the mass of each element
③ \(\sum\): add over all elements
④ and you get the \(M\): molar mass (molecular weight)
Quick example
The molar mass of water \(\mathrm{H_2O}\) (2 hydrogen atoms and 1 oxygen atom; atomic weight of H 1.008, of O 15.999) is
\(M\): molar mass of water \(=\) atomic weight of H (1.008) \(\times\) number of H (2) \(+\) atomic weight of O (15.999) \(\times\) number of O (1)
\(1.008 \times 2 + 15.999 \times 1 = 2.016 + 15.999 = 18.015\)
Key idea
The molecular weight is a relative value with no unit, like the atomic weight. The molar mass is the mass of 1 mol (mole) of the substance, with the unit g/mol. The number is exactly the same; only the meaning (the unit) differs. Upper and lower case in element symbols also matter. CO is carbon C plus oxygen O, carbon monoxide (molecular weight 28.01), while Co is a single element, cobalt (atomic weight 58.933). They are completely different.
Mass percent of an element
Figure
Standard notation (the usual math form)
\(P\) \(=\) \(w_i \times n_i\) \(\div\) \(M\) \(\times\) \(100\)
In words (symbols replaced with words)
④ \(P\): mass percent \(=\) ① \(w_i \times n_i\): mass of the element \(\div\) ② \(M\): molar mass \(\times\) ③ \(100\): to make a percent
The formula in words
① Take the mass of the element (atomic weight × count)
② divide it by the \(M\): molar mass to find its share of the whole
③ multiply by \(100\) to make it a percent
④ and you get the \(P\): mass percent of the element
Quick example
The mass percent of oxygen O (mass 15.999) in water \(\mathrm{H_2O}\) (molar mass 18.015) is
\(P\): mass percent of O \(=\) mass of O (15.999) \(\div\) molar mass (18.015) \(\times\) 100
\(15.999 \div 18.015 \times 100 \approx 88.81\)
Key idea
The mass percents of all the elements add up to 100% (rounding in the display can make it off by about 0.01%). It shows how much of a compound's mass each element makes up, as in "about 89% of the mass of water is oxygen". That is why this formula is widely used in practice, for example for the nitrogen content of fertilizers or for food composition.
To find the molar mass (molecular weight), calculate atomic weight × count for each element and add them all up. For the mass percent of an element, divide that element's mass by the molar mass and multiply by 100.

Symbols and terms

Symbols

\(M\) em The molar mass (molecular weight): the sum of the atomic weights of all the atoms in the chemical formula. As a molar mass, its unit is g/mol (grams per mole).
\(w_i\) w sub i The atomic weight of element \(i\): the relative mass of one atom of that element, with carbon-12 set to 12. (Example - H is 1.008, O is 15.999)
\(n_i\) n sub i How many atoms of element \(i\) there are in the chemical formula. (Example - in \(\mathrm{H_2O}\), 2 of H and 1 of O)
\(\sum\) sigma A symbol that means "add them all up". Here it means adding atomic weight × count, calculated for each element, over all the elements.
\(P\) pee The mass percent of an element - the share of the compound's total mass that the element makes up, as a percentage (%).

Terms

atomic weight The mass of one atom as a relative number, with the carbon-12 atom set to 12. Hydrogen is about 1.008 and oxygen about 15.999. It is the value shown on the periodic table (often labeled average atomic mass), and this calculator uses the abridged values from IUPAC (the International Union of Pure and Applied Chemistry).
molecular weight The mass of one molecule on the same scale as the atomic weight. You find it by adding the atomic weights of all the atoms in the molecule. Like the atomic weight, it is a relative value, so it has no unit.
molar mass The mass of 1 mol (6.02×10²³ particles) of a substance, in g/mol. The number is the same as the molecular weight (formula mass), so this page treats molecular weight and molar mass as the same calculation (for example, the molecular weight of water is 18.015, so its molar mass is 18.015 g/mol).
formula mass Ionic compounds such as sodium chloride \(\mathrm{NaCl}\), and metals, do not form molecules at all. So instead of "molecular weight", the sum of the atomic weights in the empirical formula is called the formula mass (or formula weight). It is calculated in exactly the same way.
chemical formula A way of writing what a substance is made of with element symbols and numbers. It covers molecular formulas (such as \(\mathrm{H_2O}\)) and empirical formulas (such as \(\mathrm{NaCl}\)). The small number at the lower right (the subscript) is the number of the atom (or bracketed group) just before it.
empirical formula A formula that shows the kinds of atoms (or ions) in a substance and their ratio in the simplest whole numbers. Substances that do not form molecules, such as ionic compounds (for example, \(\mathrm{NaCl}\)) and metals, are written this way.
hydrate A substance with water molecules (water of crystallization) inside its crystals. It is written with a dot (·) between the main part and the water, as in copper(II) sulfate pentahydrate \(\mathrm{CuSO_4 \cdot 5H_2O}\). When finding the molar mass, add the part after the dot as well.
mole (mol) A unit that counts an amount by the number of particles (atoms or molecules). 1 mol is about 6.02×10²³ particles. Since mass (g) ÷ molar mass (g/mol) = number of moles (mol), the molar mass works as the conversion factor between grams and moles.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.

Atoms, molecules and chemical formulas (middle school science)
  • Knowing that matter is made of particles called atoms, and that a molecule is several atoms joined together
  • Being able to read the small number at the lower right in \(\mathrm{H_2O}\) (the subscript) as the number of the atom just before it
Atomic weight and molecular weight (high school chemistry)
  • Knowing that the atomic weight is a relative mass with carbon-12 as the standard
  • Knowing that the molecular weight and formula mass are found by adding up atomic weights
Ratios and percents (Grades 6–7)
  • Being able to calculate "part ÷ whole × 100 = percent (%)"
Multiplying and adding decimals (Grades 5–6)
  • Being able to multiply decimals such as \(1.008 \times 2\) and add decimals such as \(2.016 + 15.999\)

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the molar mass of water H₂O
Atomic weight of H 1.008
Number of H 2
Atomic weight of O 15.999
Number of O 1
Molar mass (g/mol) =B1*B2+B3*B4
Table to find the molar mass of aluminum sulfate Al₂(SO₄)₃
Atomic weight of Al 26.982
Number of Al 2
Atomic weight of S 32.06
Number of S 3
Atomic weight of O 15.999
Number of O 12
Molar mass (g/mol) =B1*B2+B3*B4+B5*B6
Table to find the mass percent of an element (O in H₂O)
Mass of O (atomic weight × count) 15.999
Molar mass 18.015
Mass percent of O (%) =B1/B2*100
After pasting, the upper rows of column B are your inputs and the bottom row is calculated automatically.
"*" is multiplication and "/" is division. The first table calculates "atomic weight of H × count + atomic weight of O × count" with "=B1*B2+B3*B4", and B5 shows 18.015.
For the second table (a formula with parentheses), the trick is to enter the counts after expanding the parentheses (2 of Al, 3 of S and 4 × 3 = 12 of O). B7 shows 342.132.
The third table shows about 88.81 (%) in B3. Just replace the atomic weights and counts with the values for your own formula.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the molar mass of water H₂O
Atomic weight of H 1.008
Number of H 2
Atomic weight of O 15.999
Number of O 1
Molar mass (g/mol) =B1*B2+B3*B4
Table to find the molar mass of aluminum sulfate Al₂(SO₄)₃
Atomic weight of Al 26.982
Number of Al 2
Atomic weight of S 32.06
Number of S 3
Atomic weight of O 15.999
Number of O 12
Molar mass (g/mol) =B1*B2+B3*B4+B5*B6
Table to find the mass percent of an element (O in H₂O)
Mass of O (atomic weight × count) 15.999
Molar mass 18.015
Mass percent of O (%) =B1/B2*100
The same formulas as in Excel work as is. Copy the whole table, paste it into cell A1, and replace the atomic weights and counts with the values for your own formula.

How to calculate it in Python

# Atomic weights of the elements you use (IUPAC abridged values; list only the ones you need)
atomic_weight = {"H": 1.008, "C": 12.011, "N": 14.007, "O": 15.999,
                 "Na": 22.99, "S": 32.06, "Cl": 35.45, "Al": 26.982, "Cu": 63.546}

# Elements and counts in the formula (example: aluminum sulfate Al2(SO4)3 -> 2 Al, 3 S, 12 O)
composition = {"Al": 2, "S": 3, "O": 12}

# Molar mass (molecular weight) = sum of atomic weight x count over all elements
molar_mass = sum(atomic_weight[element] * count for element, count in composition.items())
print(f"Molar mass (molecular weight): {molar_mass} g/mol")

# Mass percent of each element = atomic weight x count / molar mass x 100
for element, count in composition.items():
    mass = atomic_weight[element] * count
    print(f"{element}: {mass:.3f} g/mol ({mass / molar_mass * 100:.2f}%)")
Runs with the standard library only. Put the element symbols and counts in composition, and it shows the molar mass and the mass percent of each element. For a formula with parentheses, enter the counts after expanding them (for example, (SO4)3 gives 3 of S and 12 of O).

How to write it in LaTeX and other math languages (copy and paste)

Molar mass (molecular weight)
M = Σᵢ (wᵢ × nᵢ)
M = \sum_{i} w_i n_i
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>M</mi>
    <mo>=</mo>
    <munder><mo>&#x2211;</mo><mi>i</mi></munder>
    <msub><mi>w</mi><mi>i</mi></msub>
    <mo>&#x2062;</mo>
    <msub><mi>n</mi><mi>i</mi></msub>
  </mrow>
</math>
M = sum_i (w_i n_i)
Sum[w[i]*n[i], {i, 1, k}]
M := add(w[i]*n[i], i = 1 .. k);
M = sum(w .* n);
M = ∑_i (w_i n_i)
Mass percent of an element
P = (wᵢ × nᵢ) ÷ M × 100
P = \dfrac{w_i n_i}{M} \times 100
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>P</mi>
    <mo>=</mo>
    <mfrac>
      <mrow><msub><mi>w</mi><mi>i</mi></msub><mo>&#x2062;</mo><msub><mi>n</mi><mi>i</mi></msub></mrow>
      <mi>M</mi>
    </mfrac>
    <mo>&#xD7;</mo>
    <mn>100</mn>
  </mrow>
</math>
P = (w_i n_i)/M xx 100
(w[i]*n[i]/M)*100
P := w[i]*n[i]/M*100;
P = w(i)*n(i)/M*100;
P = (w_i n_i)/M × 100

How to have ChatGPT  do the calculation

You are a chemistry calculation assistant. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

Find the molar mass (molecular weight) of copper(II) sulfate pentahydrate, CuSO4·5H2O.
Use the IUPAC abridged atomic weights (Cu = 63.546, S = 32.06, O = 15.999, H = 1.008).
Show the following, with the formulas you used and the numbers from the execution result:
1. The breakdown of "atomic weight × count" for each element (Cu, S, O, H)
2. The molar mass (g/mol)
3. The mass percent of each element (%)

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.