An npm calculator script converts a solute’s mass, molar mass, and final solution volume into molarity, then reports the result in mol/L and mM. Enter those three values below; the calculator assumes a dilute solution and uses the volume of the finished solution, not the volume of solvent added.
Formula
Molarity is the amount of solute in moles divided by the final solution volume in litres. The calculator first finds moles by dividing mass by molar mass, and converts millilitres to litres by dividing by 1,000:
c = (m / mm) / (v / 1,000)
- c is molarity, in mol/L.
- m is solute mass, in grams.
- mm is molar mass, in g/mol.
- v is final solution volume, in mL.
The second output is concentration in millimolar: cmM = c × 1,000. Since one millimole is 0.001 mole, 1 mol/L equals 1,000 mM. The conversion factors are explicit so the units cancel: grams divided by grams per mole gives moles, and millilitres divided by 1,000 gives litres.
Worked Example
Using the calculator’s default values, calculate the amount of solute first:
n = m / mm = 2.922 g / 58.44 g/mol = 0.05 mol
Convert the finished solution volume to litres:
V = v / 1,000 = 250 mL / 1,000 = 0.25 L
Divide the amount in moles by the volume in litres:
c = n / V = 0.05 mol / 0.25 L = 0.2000 mol/L
Convert molarity to millimolar:
cmM = 0.2000 mol/L × 1,000 = 200.00 mM
The calculated concentration is therefore 0.2000 mol/L, or 200.00 mM. These values use the displayed rounding settings.
Assumptions
- The input mass is the mass of the solute, and the stated molar mass matches the chemical form weighed.
- The volume entered is the final volume after the solute is dissolved and the solution is brought to volume; it is not the amount of solvent initially poured.
- The calculation treats the solution volume as the measured final volume and does not correct for temperature-dependent expansion, density, purity, or non-ideal solution behavior.
- This is general chemistry and lab-planning arithmetic. For bench work, follow your lab method, the safety data sheet (SDS), and your supervisor.
What the Calculator Does
“Npm calculator script” can refer to a small calculator written in JavaScript and run through npm, the package manager for the Node.js ecosystem. On this chemistry calculator page, however, npm is not a chemistry unit or a required tool: the calculation is simply molarity from mass, molar mass, and volume. The calculator block specifies the inputs, units, default values, formula, and displayed precision so the arithmetic can be checked.
The core relationship is useful because a weighed mass is not itself an amount in moles. Dividing by molar mass converts grams into moles. Dividing those moles by final litres gives a concentration that can be compared across samples or used in further solution calculations.
When to Use It and How to Read the Result
Use this calculation when you know the mass of a solute and the final volume of its solution, and want its nominal molar concentration. For example, if 2.922 g of a substance with molar mass 58.44 g/mol is present in 250 mL of final solution, the calculation gives 0.2000 mol/L.
- mol/L is the standard unit of molarity. A result of 0.2000 mol/L means 0.2000 moles of the specified solute per litre of solution.
- mM is often convenient for smaller concentrations. It is the same concentration expressed in millimoles per litre.
- The calculator’s decimal places are display precision, not a guarantee of experimental accuracy. The number of reliable significant figures depends on the balance, glassware or other volume measurement, reagent purity, and molar-mass value.
The output describes the amount of the compound added per solution volume. It does not automatically convert to the concentration of a particular ion or molecule produced after a reaction or dissociation. Such a conversion needs the reaction stoichiometry and, where relevant, information about chemical equilibria.
Choosing Inputs and Avoiding Common Errors
Check the chemical formula and form printed in the method or reference used to obtain the molar mass. Hydrates, salts, and other forms of the same compound can have different molar masses. For a pure compound, calculate molar mass from its formula and standard atomic weights or use a reliable reference value. If the weighed material is not pure, the nominal calculation overstates the amount of the target compound unless purity is accounted for separately.
- Use final solution volume. Dissolving a solid can change the volume. If the target is 250 mL, the relevant value is 250 mL of finished solution, not 250 mL of solvent plus solute.
- Keep units consistent. This calculator expects mass in grams, molar mass in g/mol, and volume in mL. A volume entered in litres must first be converted to millilitres, or the formula must be adapted.
- Do not confuse molarity with amount. Moles describe how much substance is present; molarity also depends on solution volume.
- Do not round too early. Keep intermediate values at full practical precision and round the reported result to match the measurement quality.
A frequent misconception is that adding a known mass to a known amount of water always gives the stated final volume. It does not necessarily do so. The distinction matters whenever concentration is defined per volume of solution.
Limits and Related Calculations
This formula assumes that the measured mass and final volume are appropriate for the intended concentration. It does not predict solubility, reaction yield, pH, dissociation, or changes caused by temperature. For concentrated or strongly non-ideal mixtures, molarity can also vary with temperature because solution volume changes; a more specialized treatment may be needed.
If you know the desired molarity and want to find the mass to weigh, rearrange the same equation: m = c × mm × (v / 1,000), with volume in mL and mass in grams. If instead you are diluting a stock solution, the usual relationship is C1V1 = C2V2, provided the concentration and volume units are used consistently and the final volume is understood correctly. Those are related calculations, but they answer different questions from this mass-to-molarity calculator.
Frequently Asked Questions
What does npm mean in “npm calculator script”?
Npm is commonly the package manager used with Node.js projects. It is unrelated to molarity itself; the chemistry calculation here can be performed without npm.
How do I calculate molarity from grams?
Divide the mass in grams by molar mass in g/mol to get moles, convert final solution volume to litres, then divide moles by litres.
Why must I enter final solution volume?
Molarity is defined per volume of solution. The volume after dissolving and bringing the mixture to its final mark may differ from the starting solvent volume.
How do I convert mol/L to mM?
Multiply the value in mol/L by 1,000. For example, 0.2 mol/L is 200 mM.
Does the result account for reagent purity?
No. It assumes the entered mass is the relevant solute mass. If purity is known and important, account for it separately according to the lab method.
Related
Formula used
in m | Mass of solute | g | 2.922 | 0 in mm | Molar mass | g/mol | 58.44 | 0 in v | Final solution volume | mL | 250 | 0 out c | Molarity | mol/L | m / mm / (v / 1000) | 4 out cmm | Concentration in millimolar | mM | c * 1000 | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.
More in this section
- Gas Correction Factor Calculator and Table1.2534
- Gas Correction Factor Formula and Calculator0.9829
- Gas Temperature: Calculate It from Pressure and Volume298.15 K
- Gas Correction Factor Calculator: Formula and Uses107.322 same as input
- Gas Cv Calculator: Heat Capacity Ratio and Formula20.786 J/(mol·K)
- Density Temperature Correction Calculator and Formula999.25 kg/m^3