Calculate unknown mass, moles, or molar mass based on two known values.
Grams (g)
Moles (mol)
Molar Mass (g/mol)
Grams (g)
Moles (mol)
Molar Mass (g/mol)
Result:
—
Understanding the Chemistry Mass Calculator
In chemistry, the relationship between mass, moles, and molar mass is fundamental for quantitative analysis and stoichiometry. This calculator helps you quickly determine any one of these three quantities when you know the other two. The core principle relies on the following definitions and relationships:
Mass: Typically measured in grams (g), this is the amount of matter in a substance.
Moles (mol): This is a unit that represents a specific number of entities (atoms, molecules, ions, etc.). One mole of any substance contains Avogadro's number of particles (approximately 6.022 x 1023). It's a convenient way to count particles in macroscopic amounts.
Molar Mass (g/mol): This is the mass of one mole of a substance. It's numerically equal to the atomic mass (for elements) or molecular mass (for compounds) but expressed in grams per mole. You can find molar masses on the periodic table or by summing the atomic masses of all atoms in a compound's formula.
The Key Formulas:
To find Moles from Mass and Molar Mass: Moles = Mass (g) / Molar Mass (g/mol)
To find Mass from Moles and Molar Mass: Mass (g) = Moles (mol) * Molar Mass (g/mol)
To find Molar Mass from Mass and Moles: Molar Mass (g/mol) = Mass (g) / Moles (mol)
How to Use the Calculator:
Enter the two known values and select their corresponding units. The calculator will then compute the unknown quantity.
Example Scenarios:
If you know the mass of a substance (e.g., 50g) and its molar mass (e.g., 18.015 g/mol for water), you can find out how many moles it represents.
If you know the number of moles of a substance (e.g., 2.5 mol) and its molar mass (e.g., 58.44 g/mol for NaCl), you can determine its mass in grams.
If you have a known mass (e.g., 10g) and a known number of moles (e.g., 0.1 mol) of an unknown substance, you can calculate its molar mass.
This calculator is invaluable for students, researchers, and chemists performing laboratory experiments, preparing solutions, and understanding chemical reactions.
function calculateMass() {
var value1 = parseFloat(document.getElementById("value1").value);
var unit1 = document.getElementById("unit1").value;
var value2 = parseFloat(document.getElementById("value2").value);
var unit2 = document.getElementById("unit2").value;
var resultValueElement = document.getElementById("resultValue");
var resultUnitElement = document.getElementById("resultUnit");
var resultContainer = document.getElementById("resultContainer");
// Clear previous results
resultValueElement.textContent = "–";
resultUnitElement.textContent = "";
resultContainer.style.display = 'none';
// Input validation
if (isNaN(value1) || isNaN(value2)) {
alert("Please enter valid numbers for both values.");
return;
}
if (value1 <= 0 || value2 Calculate Mass
if (unit1 === "moles" && unit2 === "molarMass") {
calculatedMass = value1 * value2;
unknownValue = calculatedMass;
unknownUnit = "g";
}
// Case 2: Value 1 is Molar Mass, Value 2 is Moles -> Calculate Mass
else if (unit1 === "molarMass" && unit2 === "moles") {
calculatedMass = value1 * value2;
unknownValue = calculatedMass;
unknownUnit = "g";
}
// Case 3: Value 1 is Mass, Value 2 is Molar Mass -> Calculate Moles
else if (unit1 === "grams" && unit2 === "molarMass") {
calculatedMoles = value1 / value2;
unknownValue = calculatedMoles;
unknownUnit = "mol";
}
// Case 4: Value 1 is Molar Mass, Value 2 is Mass -> Calculate Moles
else if (unit1 === "molarMass" && unit2 === "grams") {
calculatedMoles = value1 / value2;
unknownValue = calculatedMoles;
unknownUnit = "mol";
}
// Case 5: Value 1 is Mass, Value 2 is Moles -> Calculate Molar Mass
else if (unit1 === "grams" && unit2 === "moles") {
calculatedMolarMass = value1 / value2;
unknownValue = calculatedMolarMass;
unknownUnit = "g/mol";
}
// Case 6: Value 1 is Moles, Value 2 is Mass -> Calculate Molar Mass
else if (unit1 === "moles" && unit2 === "grams") {
calculatedMolarMass = value1 / value2;
unknownValue = calculatedMolarMass;
unknownUnit = "g/mol";
}
// Handle cases where input units are the same (invalid scenario for this calculator)
if (unit1 === unit2) {
alert("Cannot calculate with two identical units. Please ensure you have two different values.");
return;
}
// If no calculation was performed (e.g., units were not a valid combination)
if (unknownValue === null) {
alert("Invalid unit combination. Please select two different units for calculation.");
return;
}
// Display result
resultValueElement.textContent = unknownValue.toFixed(4); // Display with reasonable precision
resultUnitElement.textContent = unknownUnit;
resultContainer.style.display = 'block';
}