Empirical formula versus molecular formula
What separates the simplest ratio from the true molecular formula, and how to get from one to the other using the compound's molar mass.
Two formulas, two questions
The empirical formula answers what ratio the atoms come in, while the molecular formula answers how many atoms are actually in one molecule. Glucose is the classic example: its empirical formula is CH2O, a one to two to one ratio, but a real glucose molecule is C6H12O6, exactly six times larger. Both are correct, they just describe the compound at different levels of detail. This calculator finds the empirical formula, the reduced ratio, from mass or percent data alone.
The classic step by step method
The procedure this tool automates is the one taught in every introductory chemistry course. First, assume a 100 gram sample so percentages become grams. Second, divide each mass by that element's atomic mass to convert to moles. Third, divide every mole count by the smallest of them, which sets the least abundant element to one. Fourth, if the ratios are not already whole, multiply them all by the smallest integer that clears the fractions. The result is the empirical formula, and the tool prints the moles and the final subscript for each element so you can follow along.
Getting to the molecular formula
To promote an empirical formula to a molecular formula you need one more piece of data: the compound's molar mass, usually from an experiment like mass spectrometry or freezing point depression. Add up the atomic masses in the empirical unit to get its formula mass, then divide the measured molar mass by that number. The whole number you get is the multiple. For CH2O the empirical mass is about 30 g/mol, and glucose at roughly 180 g/mol divides to 6, giving C6H12O6. This tool stops at the empirical step, so pair it with a molar mass calculator to finish.
Where rounding can trip you up
Empirical formula problems live and die by clean arithmetic. Real lab percentages carry measurement error, so a ratio that should be 2 might compute as 1.98 or 2.03. The calculator treats any scaled value within 0.12 of an integer as that integer, which forgives normal textbook rounding while still telling 1.5 apart from 1 or 2. If your data is noisy the multiplier search up to six may pick an unintended factor, so enter percentages to at least one decimal place and make sure they sum close to 100 for the most reliable result.