# Empirical formula calculator > How do you find a formula from percent composition? Enter each element's mass percentage or grams and get the simplest whole-number formula, and the molecular formula from a molar mass. Turn mass percentages or grams of each element into the empirical formula, with every mole ratio shown, and the molecular formula from the molar mass. - Page: https://how.box/empirical-formula/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/empirical-formula/?c={c}&b={b}&m={m} - `c` (text): Element symbols with their mass % or grams. Example: `C 40.0, H 6.71, O 53.3`. - `b` (percent or grams): percent (default) or grams. Example: `percent`. - `m` (number 1 to 100000): Molar mass of the compound in g/mol, for the molecular formula. Example: `180.16`. Example answer: https://how.box/empirical-formula/?c=C+40.0%2C+H+6.71%2C+O+53.3&b=percent&m=180.16 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `empirical_formula_calculate`: Empirical formula from a composition: moles n = mass ÷ atomic weight per element, divided by the smallest, times the smallest whole multiplier (≤ 12) that brings every ratio within 0.1 of a whole number; with molar_mass also the molecular formula (empirical × M ÷ M(empirical), a whole number). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"empirical_formula_calculate","arguments":{"composition":"C 40.0, H 6.71, O 53.3","basis":"percent","molar_mass":180.16}}}` - GET: https://how.box/mcp/run/empirical_formula_calculate?composition=C+40.0%2C+H+6.71%2C+O+53.3&basis=percent&molar_mass=180.16 ## How it works An empirical formula gives the simplest whole-number ratio of atoms in a compound. Analysis gives the mass of each element, but formulas count atoms, so the masses are turned into amounts in moles and compared. For each element, n = m ÷ M: its mass (or, for percentages, its grams in a 100 g sample) divided by its atomic weight. Divide every n by the smallest and round; a ratio such as 1.5 or 1.33 is first multiplied by 2 or 3 to clear the fraction. Nicotine is 74.02 % C, 8.710 % H and 17.27 % N: 6.163, 8.641 and 1.233 mol, a ratio of 5.00 : 7.01 : 1.00, so C₅H₇N (81.12 g/mol). Its molar mass of 162.2 g/mol is 2 × 81.12, so the molecular formula is C₁₀H₁₄N₂. The method follows OpenStax Chemistry 2e, section 3.2. Measured percentages carry errors, so a ratio within 0.1 of a whole number is taken as whole. Results far from any simple ratio usually mean a missing element (often oxygen, found by difference) or a measurement error. ## FAQ **Can composition tell me how the atoms are connected?** No. Different compounds can have the same empirical or molecular formula. The result describes atom counts, not the arrangement of bonds. **What if the percentages do not add up to 100?** Often one element was not measured and is found by difference: give it 100 minus the others. The calculator still works from the ratios and notes the sum. **Can I enter element names instead of symbols?** Use chemical symbols, such as C for carbon and Na for sodium. Enter each element once, followed by its amount. **Can I mix grams and percentages in one calculation?** No. Use the same basis for every element: either masses from the same sample or mass percentages. Mixing the two changes the ratios. **Why is no molecular formula shown for my molar mass?** The molecular molar mass must be close to a whole-number multiple of the empirical formula’s molar mass. Check the entered molar mass and composition if no multiple fits. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)