ForHosting KIT · Science

Empirical formula calculator

Type each element's amount and get the simplest whole-number formula: 40 % carbon, 6.7 % hydrogen and 53.3 % oxygen give CH2O. Grams or percentages both work, and standard atomic weights are already built in. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

An empirical formula is the simplest whole-number ratio of atoms in a chemical compound, not necessarily the same as the molecular formula. Laboratory reports often list each element as a mass in grams or as a mass percent; converting those numbers into moles, normalizing by the smallest mole amount, and clearing fractional ratios is the standard stoichiometry path taught in general chemistry. This capability runs that path deterministically with a fixed table of conventional atomic weights, returns a Hill-ordered formula string plus a structured breakdown of moles and integer counts, and rejects all-zero compositions with a clear invalid input error so pipelines never invent atoms from empty data.

From lab numbers to the simplest formula

An empirical formula is the simplest whole-number ratio of atoms in a compound, which is not always the same as the molecular formula. Lab reports usually give each element either as grams from a weighed sample or as a mass percent from an elemental analysis. Either way the path is the same: convert every amount to moles with standard atomic weights, divide by the smallest mole amount, and clear any remaining fractions to whole numbers. With 40 % carbon, 6.7 % hydrogen and 53.3 % oxygen the ratios come out close to 1, 2 and 1, so the formula is CH2O.

Grams or percent, and the mistakes to avoid

Because only relative amounts matter, grams and percentages give the same atom counts when the data are consistent, so you can type the numbers exactly as your report lists them. Write element symbols exactly, with the right capital letters, such as Fe or Cl; symbols that are not recognized are rejected. An element entered as zero is simply dropped, but if every amount is zero there is nothing to reduce and you get a clear error instead of an invented formula. The result lists the moles, the mole ratio and the whole-number count for each element, so you can check every line of your own working.

Homework and lab report checks

Students enter mass percent from combustion or CHN analysis, compare the returned formula and mole ratios term by term, and get a clear error when every amount is left at zero.

How do I find the empirical formula from percent composition?

The response includes formula (for example CH2O) plus moles and integer counts per element.

Can I use mass in grams instead of percent?

Yes. The reduction uses relative amounts only, so grams and mass percent that represent the same composition produce the same empirical formula. Optional mode can label the values as mass or percent.

What happens if all element amounts are zero?

At least one positive mass or percent is required; empty all-zero compositions are rejected and not charged.

Is the empirical formula calculator free?

The browser tool runs free on your device.

How is this different from a molar mass calculator?

Molar mass tools start from a formula and sum atomic weights. This capability goes the opposite direction: from measured masses or percents to the simplest whole-number formula.

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.

POSThttps://api.kit.forhosting.com/chem/empirical-formula

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.

curl -X POST https://api.kit.forhosting.com/chem/empirical-formula \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"elements":{"C":40,"H":6.7,"O":53.3}}'
{
  "elements": {
    "C": 40,
    "H": 6.7,
    "O": 53.3
  }
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.empirical_formula",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Students, tutors, LIMS scripts, and homework checkers can pin the JSON in tests without installing a chemistry package.

What mass or percent composition means and how to send elements

Prepare a map of case-sensitive element symbols to non-negative finite amounts. Values may be grams of each element from a weighed sample or mass percentages from an elemental analysis report—the mathematical reduction to an empirical formula depends only on relative amounts, so both interpretations produce the same atom counts when the data are consistent. String numbers are accepted when trimmed and finite. Keys must be standard symbols such as H, C, O, Fe, or Cl; unrecognized symbols and malformed keys fail with invalid_input. Optional mode may be mass, percent, or auto; auto is the default and simply labels the request for your UI without changing the mole arithmetic. At least one amount must be strictly positive: if every value is zero the engine raises invalid_input and does not invent a formula. Zero entries mixed with positive ones are dropped so you can reuse a full periodic-template payload without manual cleanup. Cap the map at a modest number of elements for Worker isolate safety; ordinary teaching examples with two to six elements are the intended workload. Aliases composition, masses, and percentages are accepted for the elements object so SDKs and forms can use domain language without inventing a second code path.

Reading moles, ratios, integer counts, and the formula string

Atomic weights follow common classroom tables used with molar-mass tools in this catalog; they are not live IUPAC downloads and do not change between identical requests. The formula string is ordered with the Hill system: carbon first when present, then hydrogen, then remaining symbols alphabetically, so organics read like CH2O while inorganic binaries such as Fe2O3 remain familiar. On success the response includes formula, the echoed mode, element_count, an elements array, the integer multiplier used before GCD reduction, total_amount of the supplied values, and method equal to mole_ratio_integer. Each elements entry lists symbol, amount, atomic_weight from the static conventional table, moles, mole_ratio after dividing by the smallest mole quantity, and the final whole-number count. Use formula alone when a label or flashcard needs a single string; use the elements array when a grader must verify mole ratios and counts separately; use total_amount to confirm the client summed percentages near one hundred or preserved the sample mass. Missing elements, empty maps, negative amounts, unknown symbols, and all-zero compositions all fail with invalid_input and are not charged after the engine rejects the request.

API usage, pricing, classroom workflows, and practical limits

Call the free in-browser empirical formula calculator for homework checks, lecture demos, and quick lab report verification without installing ChemDraw plugins or a local stoichiometry library. Measurement noise in lab percentages can push ratios slightly off integers; the engine searches small integer multipliers within a fixed tolerance and then reduces by GCD so classic answers such as CH2O and Fe2O3 remain stable for clean textbook data. Authors shipping SDKs can map the elements array directly into UI tables that show amount, moles, ratio, and count—the same columns students compute by hand when they find an empirical formula on paper. Send a JSON body with the required elements object and optional mode string. Use the prepaid API when a tutoring platform, coding-assessment sandbox, LIMS helper, or curriculum generator needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Pair this endpoint with a molar mass calculator when the next step is converting the empirical formula into grams per mole, or with your own molecular-mass factor when the molecular formula is n times the empirical unit.

Tutoring and auto-graded drills

Lesson builders generate composition-to-formula exercises with structured JSON for flashcards and graders without embedding a full chemistry CAS stack.

LIMS and lightweight stoichiometry pipelines

Scripts that already store elemental mass or percent maps call a stable prepaid endpoint instead of reimplementing mole-ratio rounding in every language.

Read the full KIT documentation →