Home › Chemistry › Empirical Formula Calculator
Empirical Formula Calculator
Converts the mass percentages (or masses) of each element into moles, divides by the smallest amount and scales to the smallest whole-number ratio to give the empirical formula; with a molar mass it also returns the molecular formula.
When to use
You have elemental analysis data (mass percent or grams of each element) and need the empirical formula, or the molecular formula when the compound's molar mass is known.
Do not use when: You start from a formula and need its percent composition or molar mass (use molar-mass), or the data are moles of each element already (write them as the counts directly).
Formula
moles_i = mass_percent_i / atomic_weight_i; ratio_i = moles_i / min(moles); subscript_i = round(ratio_i × f) for the smallest integer f (1–12) that makes every ratio_i × f within 0.1 of an integer; n = round(molar_mass / empirical_formula_mass); molecular formula = (empirical formula)_n
Percentages are treated as grams of a 100 g sample, so masses in grams give the same result. Atomic weights are the IUPAC 2021 abridged values; ratios that stay more than 0.1 from an integer for every multiplier up to 12 are rounded with the best multiplier and flagged in a note.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
composition | string_list | yes | Element symbols each followed by its mass percent or mass in grams, e.g. ["C 40.0", "H 6.7", "O 53.3"] or the single string "C 40.0, H 6.7, O 53.3" (also C:40.0 or C=40.0). Symbols are case-sensitive. | |
molar_mass_g_mol | number | g/mol | no | Molar mass of the compound (e.g. from mass spectrometry or colligative properties); when given, the molecular formula is derived. Range: > 0, ≤ 10000000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
empirical_formula | string | Simplest whole-number ratio of atoms, with the elements in the order they were entered. | |
empirical_formula_mass_g_mol | number | g/mol | Molar mass of one empirical formula unit. |
molecular_formula | string | Empirical formula multiplied by molecular_multiplier (only when molar_mass_g_mol is given). | |
molecular_multiplier | integer | molar_mass_g_mol / empirical formula mass, rounded to the nearest integer. | |
molecular_formula_mass_g_mol | number | g/mol | Molar mass of the molecular formula found (compare with the input molar mass). |
ratio_multiplier | integer | Factor applied to the mole ratios to reach whole numbers (e.g. 2 when a ratio ends in .5). | |
elements | list | Per element: symbol, mass (or percent) given, atomic weight, moles, ratio to the smallest and the subscript in the empirical formula. | |
total_mass | number | Sum of the values entered (should be about 100 for percentages). |
Example
C 40.0 %, H 6.7 %, O 53.3 %, molar mass 180.16: {"composition":["C 40.0","H 6.7","O 53.3"],"molar_mass_g_mol":180.16} → {"empirical_formula":"CH2O","empirical_formula_mass_g_mol":30.026,"molecular_formula":"C6H12O6","molecular_multiplier":6,"molecular_formula_mass_g_mol":180.156,"ratio_multiplier":1,"total_mass":100}
Hematite: Fe 69.94 %, O 30.06 %: {"composition":"Fe 69.94, O 30.06"} → {"empirical_formula":"Fe2O3","empirical_formula_mass_g_mol":159.687,"ratio_multiplier":2}
GET https://tttkmbb.com/api/v1/calculate/empirical-formula?composition=C+40.0%2CH+6.7%2CO+53.3&molar_mass_g_mol=180.16
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/empirical-formula(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/empirical-formula · Markdown: https://tttkmbb.com/chemistry/empirical-formula.md · JSON definition: https://tttkmbb.com/chemistry/empirical-formula.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="empirical-formula" - OpenAPI operationId:
calculate_empirical_formula - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
My ratios come out as 1.33 or 1.5. What happens?
The calculator multiplies all ratios by the smallest integer (3 or 2 here) that turns them into whole numbers, which is how Fe2O3 or C3H8 arise from 1 : 1.5 or 1 : 2.67 ratios.
Can I enter grams instead of percentages?
Yes. Only the ratios matter, so masses from a combustion analysis (e.g. grams of C, H and O) work directly; the sum of inputs is reported so you can check it.
Why does the molecular formula mass differ slightly from my molar mass?
The multiplier is rounded to an integer; the reported molecular_formula_mass_g_mol is the exact mass of the formula found. A multiplier far from an integer (flagged in a note) suggests an error in the data.
Related calculators
- Molar Mass Calculator — Percent composition and molar mass of the formula found.
- Mass Percent Calculator — Mass percent of a component in a mixture.
- Moles to Grams Calculator — Grams-to-moles conversion for one substance.