Empirical formula from percent composition calculator
Turn mass percentages into the simplest whole-number formula: 11.19 % hydrogen and 88.81 % oxygen, with their atomic masses, give H2O. You see the moles, the ratios and any multiplier used to clear fractions. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Runs in your browser. Free, unlimited — your data never leaves this page.
This empirical formula from percent composition calculator turns element mass percentages and atomic masses into the simplest whole-number subscripts of an empirical formula. In general chemistry you often measure or are given the mass percent of each element in a pure compound, convert each percent into a relative mole amount by dividing by the atomic mass, divide through by the smallest mole amount, and clear any remaining fractions so every subscript is a small integer. Classic classroom checks include hydrogen and oxygen near eleven and eighty-nine percent yielding H2O, and carbon, hydrogen, and oxygen near forty, six point seven, and fifty-three percent yielding CH2O for the glucose empirical unit. The engine is fully deterministic: no network calls, no sampling, and no date-dependent shortcuts.
Where empirical formulas from percent composition fit in study, lab work, and software
Students meet this calculation when a textbook gives elemental analysis percentages and asks for the empirical formula before any molecular-mass scale-up, when a combustion analysis reports carbon, hydrogen, and oxygen shares, or when they check whether two samples with the same composition share the same simplest formula. Teachers can pre-generate answer keys for modest multi-element sets without trusting opaque calculator apps that silently change atomic masses or round ratios inconsistently.
Lab technicians and quality checks use the same ratios when a certificate of analysis lists mass percents and the theoretical empirical unit must be compared against a known series of salts or hydrates described elsewhere. Developers call the same contract from scripts to seed deterministic test vectors for chemistry tutors, to normalize user-entered composition tables before a lab notebook export, or to satisfy programming-challenge statements that demand integer subscripts rather than a hand-waved sketch.
What you can do with it
Homework and worksheet keys
Convert textbook mass-percent tables and atomic masses into empirical formulas such as H2O or CH2O before grading.
Lab and tutoring software
Normalize user-entered percent composition into simplest integer subscripts for interactive lessons and checks.
FAQ
What does the empirical formula from percent composition calculator cost?
It is free in your browser on this page.
How are empirical subscripts defined from mass percent?
Divide every mole amount by the smallest, then scale the ratios to the lowest whole-number subscripts.
What happens if an atomic mass is zero?
A zero atomic mass would make the mole calculation divide by zero and is not allowed.
Is the empirical formula the same as the molecular formula?
Not always. The empirical formula is the simplest integer ratio. The molecular formula is an integer multiple of that ratio when the true molar mass is known.
Do I need to supply element symbols?
Without them, placeholders such as E1 and E2 are used in order.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/chem/empirical-from-percent \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"elements":[{"symbol":"H","percent":11.19,"atomic_mass":1.008},{"symbol":"O","percent":88.81,"atomic_mass":15.999}]}'const res = await fetch("https://api.kit.forhosting.com/chem/empirical-from-percent", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"elements": [
{
"symbol": "H",
"percent": 11.19,
"atomic_mass": 1.008
},
{
"symbol": "O",
"percent": 88.81,
"atomic_mass": 15.999
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/empirical-from-percent",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"elements": [
{
"symbol": "H",
"percent": 11.19,
"atomic_mass": 1.008
},
{
"symbol": "O",
"percent": 88.81,
"atomic_mass": 15.999
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/empirical-from-percent", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"elements":[{"symbol":"H","percent":11.19,"atomic_mass":1.008},{"symbol":"O","percent":88.81,"atomic_mass":15.999}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"elements":[{"symbol":"H","percent":11.19,"atomic_mass":1.008},{"symbol":"O","percent":88.81,"atomic_mass":15.999}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/empirical-from-percent", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"elements": [
{
"symbol": "H",
"percent": 11.19,
"atomic_mass": 1.008
},
{
"symbol": "O",
"percent": 88.81,
"atomic_mass": 15.999
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.empirical_from_percent",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_elements | 40 |
max_abs | 1000000000000000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
What an empirical formula from percent composition means and what the response contains
An empirical formula states the simplest whole-number ratio of atoms of each element in a compound, not necessarily the molecular formula that counts atoms in one real molecule. When composition is given as mass percent, the standard path pretends you have one hundred grams of pure sample so each mass percent becomes grams of that element, divides each mass by the element’s atomic mass to obtain moles, then divides every mole value by the smallest mole value to produce ratios near small integers. If a ratio is clearly a half, third, or other simple fraction, all ratios are multiplied by a small integer until every subscript rounds cleanly to a whole number, after which a greatest-common-divisor reduction keeps the formula in lowest terms. This calculator returns an elements array with symbol, input mass percent, atomic mass used, moles, normalized ratio, and final integer subscript for each element, plus a subscripts array in the same order, a compact empirical_formula string such as H2O or CH2O, the integer multiplier used when clearing fractions, the minimum mole amount, the precision used, the method tag empirical_from_percent, a short formula reminder, a definition string, and a unit hint. There is no live atomic-weight lookup and no stochastic rounding race: you supply the atomic masses you want, and the arithmetic either finishes with stable integers or rejects the request. Rejected cases include a missing element list, empty arrays, non-finite percents or masses, non-positive mass percents, and any atomic mass that is zero or non-positive, because dividing by a zero atomic mass is undefined and would not produce a physical mole amount.
How elements, percents, and atomic masses are read and how subscripts stay reproducible
If symbols are omitted, placeholders such as E1 and E2 still yield a readable formula string for automated checks. Computation uses only finite division and a bounded search for the smallest integer multiplier that clears fractional ratios within a fixed tolerance, then reduces by gcd. The preferred field is elements, an array of objects each carrying a mass percent and an atomic mass in grams per mole, with an optional symbol used when building the empirical formula string. Aliases composition, data, and items are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. Inside each object, percent may also arrive as mass_percent, pct, mass_pct, or percentage, and atomic_mass may arrive as A, atomicMass, molar_mass, mm, or atomic_weight. Alternatively you may send parallel arrays percents and atomic_masses, with optional symbols of matching length, which is convenient when a notebook already stores columns separately. Mass percents must be finite and positive; atomic masses must be finite and strictly greater than zero, because a zero atomic mass is rejected with invalid_input naming the field. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for moles, ratios, and echoed percents and atomic masses, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the empirical-formula steps yourself.
Where empirical formulas from percent composition fit in study, lab work, and software
Product and education tools use the endpoint when a learner types mass percents and atomic masses and the UI must show moles, ratios, and a compact formula string. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with percent composition or molar-mass helpers when you need related quantities, and with other science endpoints when you are building a small lab of free, deterministic chemistry calculators.
Integration use cases
Deterministic test fixtures
Generate reproducible moles, ratios, subscripts, and empirical_formula strings for unit tests, tutors, and CI.