ForHosting KIT · Science

Molar mass calculator

Water, H2O, weighs 18.015 g/mol: two hydrogens at 1.008 and one oxygen at 15.999. Type any formula, with parentheses or a hydrate dot, and get its molar mass plus each element's contribution. Free in your browser.

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

Molar mass links the microscopic composition of a compound to a practical laboratory quantity: grams per mole. Given a chemical formula such as water, carbon dioxide, glucose, or a salt with parentheses like calcium hydroxide, this capability parses the formula, multiplies each element by its standard atomic weight, and returns the total molar mass in grams per mole together with a per-element breakdown of counts and mass contributions. Unrecognized element symbols fail with a clear invalid input error instead of guessing.

From a formula to grams per mole

Molar mass connects a chemical formula to something you can weigh: the grams in one mole of the substance. To find it, count how many atoms of each element the formula holds, multiply each count by that element's standard atomic weight and add the results. Water has two hydrogens at 1.008 and one oxygen at 15.999, so its molar mass is 18.015 g/mol. Groups in parentheses, square brackets or braces are multiplied by the number after them, so Ca(OH)2 holds two oxygens and two hydrogens. A hydrate written with a middle dot or an asterisk, such as CuSO4·5H2O, adds five whole water units. Alongside the total you see each element's atom count and contribution, so hand work can be checked line by line.

Typical mistakes when typing a formula

Element symbols are case-sensitive: a capital letter, then an optional lowercase one. Fe is iron, while FE is not read as iron, and any symbol that is not recognized is named in the message instead of guessed. Unmatched parentheses and dangling numbers are refused as well. The atomic weights are the conventional values used in classroom stoichiometry and stay the same from one use to the next. If you need isotopic detail or the exact monoisotopic mass used in mass spectrometry, that is a different calculation and this tool is not the right one.

How formula parsing and atomic weights produce molar mass

Write a standard chemical formula using case-sensitive element symbols: a capital letter optionally followed by lowercase letters, then an optional positive integer subscript. Water is H2O, carbon dioxide is CO2, and glucose is C6H12O6. Groups may be wrapped in parentheses, square brackets, or braces with a trailing multiplier, so calcium hydroxide is Ca(OH)2 and iron three sulfate is Fe2(SO4)3.

Hydrate-style separators such as a middle dot or asterisk are accepted so CuSO4·5H2O expands into copper, sulfur, oxygen, and five water units. The engine walks the string left to right, expands nested groups, multiplies atom counts, and looks up each symbol in a static table of conventional standard atomic weights in grams per mole. Identical inputs always produce identical outputs because there is no network call, no model, no random seed, and no wall clock in the path.

Homework and lab report checks

Students enter H2O, NaCl, or Ca(OH)2, compare the returned g/mol and element contributions with hand work, and get a clear error when a symbol is mistyped.

What happens if the element symbol is not recognized?

Correct capitalization (for example Fe, not FE) and use valid element symbols only.

Does this support parentheses and hydrates?

Yes. Nested groups like Ca(OH)2 and hydrate forms such as CuSO4·5H2O are expanded before summing atomic weights.

Is the molar mass calculator free?

The browser tool runs free on your device.

Are the atomic weights exact IUPAC live values?

The engine uses a fixed table of conventional standard atomic weights for deterministic classroom and pipeline results. It does not fetch live IUPAC updates or isotopic distributions.

What is the molar mass of water?

It is 18.015 g/mol. The two hydrogen atoms contribute 2 × 1.008 = 2.016 and the oxygen atom contributes 15.999, and the breakdown shows both shares next to the total.

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/molar-mass

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/molar-mass \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"formula":"H2O"}'
{
  "formula": "H2O"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.molar_mass",
  "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.

The algorithm is fully deterministic arithmetic on a fixed atomic-weight table, so homework checkers, lab notebooks, inventory tools, and teaching apps can pin the same JSON in tests without calling a chemistry CAS or scraping periodic-table sites.

How formula parsing and atomic weights produce molar mass

The molar mass is the sum over symbols of atomic weight times count, rounded to a stable six decimal places for reproducible JSON. Missing formula, empty strings, unmatched parentheses, dangling coefficients, and any symbol not present in the table raise invalid_input and are not charged.

Reading the response: total mass, elements, and units

Atomic weights follow commonly tabulated conventional values used in classroom stoichiometry; they are not live IUPAC downloads and do not change between requests. If you need isotopic fine structure or exact monoisotopic mass for mass spectrometry, this product is the wrong tool—those are different search intents and different algorithms. Validation failures such as an unknown symbol Xx mention the unrecognized element so students can correct capitalization (Fe versus FE) without reading a stack trace. On success the response echoes the trimmed formula string, the numeric molar_mass, the unit string g/mol, element_count, and an elements array ordered by first appearance in the formula. Each elements entry includes symbol, integer count after expanding groups, the tabulated atomic_weight, and contribution equal to atomic_weight times count rounded the same way as the total. Use molar_mass alone when a label or barcode needs a single grams-per-mole figure; use the elements array when a lab report, grading rubric, or spreadsheet must show how hydrogen, oxygen, and carbon each contribute to the total. The method field is always atomic_weight_sum so downstream code can branch without sniffing shapes.

API usage, pricing, classroom labs, and practical limits

Call the free in-browser molar mass calculator for homework checks, lecture demos, and quick lab prep without installing a chemistry package. Authors shipping SDKs can map the elements array into a table of symbol, count, atomic weight, and contribution—the same columns students fill by hand when they compute molar mass from a periodic table. Send a JSON body with the required string field formula; aliases chemical_formula, molecule, and expr are accepted when documented by the SDK. Use the prepaid API when a LIMS integration, tutoring platform, recipe calculator, or inventory system needs a stable contract under KIT balance at $0.002 per successful item; validation failures never consume balance after the engine rejects the request. Formula length is capped for Worker isolate safety while still covering ordinary inorganic salts, organics, and multi-hydrate teaching examples. Pair this endpoint with unit conversion or stoichiometry helpers in your own pipeline when the next step is converting grams to moles or building balanced equation checkers.

Teaching apps and auto-graded drills

Curriculum tools generate formula-to-molar-mass exercises with structured JSON for flashcards and rubrics without embedding a full chemistry CAS.

Inventory and process calculators

Scripts convert catalog formulas into grams-per-mole constants for batch sizing, dilution math, and material balance sheets via a stable prepaid endpoint.

How do I calculate molar mass from a chemical formula?

Send JSON with formula set to a string such as H2O or Fe2(SO4)3. The response includes molar_mass in g/mol and an elements breakdown with counts and contributions.

Read the full KIT documentation →