ForHosting KIT · Science

Mass of element in sample calculator

Find how many grams of an element a compound sample holds: 100 g of sample in which that element makes up a mass fraction of 0.32, or 32 %, contains 32 g of it, with each step of the multiplication shown. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Sample mass
100
Mass fraction
0.32
You get
Mass percent
32
Element mass
32

A mass of element in sample calculator turns a compound sample mass and the element mass fraction into the grams (or other mass unit) of that element present in the sample. Enter the total mass of the sample and the unitless mass fraction of the target element—zero point three two for thirty-two percent by mass—and the tool returns element mass equals sample mass times mass fraction, plus the equivalent mass percent, a readable formula, and step-by-step substitution so you can check the arithmetic by hand. Homework checks, assay back-calculations, and coding kata expected values all need that same deterministic product without opening a spreadsheet.

What element mass from mass fraction means

In quantitative chemistry the mass of a single element inside a compound sample is the product of the sample mass and the mass fraction of that element. A fraction of zero point three two means thirty-two percent of the sample mass is that element; multiplying one hundred grams of sample by zero point three two therefore yields thirty-two grams of the element.

Mass fraction is the same ratio that appears as mass percent divided by one hundred, so textbooks that quote percent composition by mass convert to fraction before this multiply. Because both sample mass and element mass use the same mass unit, grams cancel with grams and kilograms cancel with kilograms; you never mix milliliters of volume into this definition. The mass fraction itself may come from a percent-composition calculation, an assay certificate, or a stoichiometric formula weight ratio—this calculator does not recompute atomic weights or look up tables.

It implements the closed product only. When the mass fraction is greater than one, more than one hundred percent of the sample would be claimed as a single element, which is non-physical for a pure fraction, so the tool rejects the input rather than returning an element mass larger than the sample for an invalid fraction. Negative sample mass or negative fraction is likewise rejected.

Homework checks for element mass in a sample

Students enter sample mass and element mass fraction from textbook percent-composition problems and compare hand-written element mass against a deterministic result before submitting.

Assay and batch tickets

Technicians convert certified mass fractions and weighed sample sizes into grams of target element for inventory or impurity budgets without spreadsheet copy errors.

How do I find the mass of an element in a sample?

Use a unitless fraction between 0 and 1 (mass percent ÷ 100).

What if my mass fraction is greater than 1?

A mass fraction above one is not physical for an element fraction in a pure sample (more than 100% of the mass).

Is mass fraction the same as mass percent?

They describe the same composition on different scales.

Does this compute percent composition from atomic weights?

No. It only multiplies sample mass by a mass fraction you already have. Use a percent-composition or molar-mass tool first if you need the fraction from a formula.

Is the mass of element in sample calculator free?

The browser tool is free and runs locally.

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/mass-of-element-in-sample

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/mass-of-element-in-sample \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sample_mass":100,"mass_fraction":0.32}'
{
  "sample_mass": 100,
  "mass_fraction": 0.32
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.mass_of_element_in_sample",
  "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.

max_abs1000000000000
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.

When the mass fraction exceeds one the value is not physical for an element fraction in a pure sample, so the API returns a clear invalid_input error instead of inventing more element than sample.

What element mass from mass fraction means

The defining formula is m_element equals m_sample times mass_fraction, where mass_fraction is unitless and lies between zero and one inclusive.

How to call the API and what comes back

Send a JSON body with two required finite numbers: sample_mass (aliases mass_sample, m_sample, sample, compound_mass, total_mass) and mass_fraction (aliases fraction, element_fraction, w_element, weight_fraction, element_mass_fraction). Absolute values must stay within the published limit of one trillion so intermediate products remain finite in IEEE double precision on the Worker and in the browser. Sample mass must be non-negative; mass fraction must lie in the closed interval from zero to one—values strictly above one, or any negative fraction, are rejected with invalid_input. On success the response echoes rounded sample_mass and mass_fraction, sets element_mass to the rounded product, mass_percent to mass_fraction times one hundred, unit to a string noting that mass units match the sample, formula to m_element equals m_sample times mass_fraction, message to a short English summary, and steps to an ordered array of substitution lines you can assert in tests or worksheets. Failed validation—missing fields, non-finite numbers, values outside absolute limits, negative sample mass, negative mass fraction, or mass fraction above one—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price. Prefer numeric JSON fields when you control the client; string numbers are accepted only when they match a strict finite numeric pattern.

Practical tips, limits, and related searches

Keep the sample mass in the same unit you want for the element mass; converting kilograms of sample and expecting milligrams of element without scaling yourself is outside the scope of this calculator. If your source gives mass percent rather than mass fraction, divide by one hundred before calling—or pass the fraction form directly, for example zero point two five for twenty-five percent. Prefer this capability when you already have the sample mass and the element fraction and only need the element mass; if you still need the fraction from formula weights, compute percent composition first, then convert to fraction and call here. For teaching, pair examples: one hundred grams of sample with mass fraction zero point three two yields thirty-two grams of element; fifty grams with fraction zero point one yields five grams; and mass fraction one point five demonstrates the hard invalid_input path that blocks non-physical fractions above one. This landing targets people searching for a mass of element in sample calculator, element mass from mass fraction, or how much of an element is in a compound sample online. It is not a mass-percent concentration tool for solutions, not a percent-composition calculator from molar masses, and not an atomic-weight table. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately set the fraction above one. Round-trip checks are easy: recompute sample mass times mass fraction by hand and confirm it equals the published element_mass within the same twelve-decimal rounding, and confirm that mass_percent equals mass_fraction times one hundred.

Unit tests for formulation software

Generate known-good element-mass products and deliberate mass-fraction-above-one rejections for coding kata expected values and CI fixtures.

Read the full KIT documentation →