Percent purity calculator
4.85 g of pure substance in a 5 g sample is 97 % pure: enter the two masses in the same unit and get the purity, the purity fraction and each step of the arithmetic for your assay report or homework. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Pure mass
- 4.85
- Sample mass
- 5
- Percent purity
- 97 %
- Purity fraction
- 0.97
A percent purity calculator turns two laboratory masses into the purity figure used on assay reports, homework, and quality-control sheets. Enter the mass of the pure substance recovered or measured and the total mass of the impure sample; the tool returns percent purity equals pure mass divided by sample mass times one hundred, plus the unitless purity fraction, a readable formula, and step-by-step substitution so you can check the arithmetic by hand.
What percent purity means for samples
Percent purity is the fraction of a sample’s mass that is the desired pure substance, expressed on a percentage scale. The defining formula is percent purity equals mass of pure substance divided by mass of sample times one hundred. The denominator is the total sample mass—including impurities—not the impurity mass alone, which is a common homework trap.
Because both numerator and denominator use the same mass unit, grams cancel with grams and kilograms cancel with kilograms; you never mix milliliters of volume with grams of pure product in this definition unless you have already converted volume to mass. A ninety-seven percent pure salt sample therefore means ninety-seven grams of pure salt in every one hundred grams of sample, which is not the same as mass percent of a solution (solute in solvent) or reaction percent yield (actual product over theoretical product).
Purity fraction is the same ratio without the factor of one hundred, so a percent purity of ninety-seven corresponds to a purity fraction of zero point nine seven. Classroom problems, pharmacopeia assays, and industrial certificate-of-analysis statements all rely on this definition. This calculator implements that closed formula only: it does not convert volume percent, mole percent, elemental composition, karat gold fineness, or reaction yield, and it does not look up densities.
When sample mass is zero or non-positive the ratio is undefined, so the tool rejects the input rather than inventing a purity for an empty weighing.
Practical tips, limits, and related searches
Keep both masses in the same unit before you call the tool; converting kilograms of sample and grams of pure substance yourself is outside the scope of this calculator and will produce a wrong percentage if left inconsistent. Prefer sending numbers rather than pre-formatted strings when you control the client; string numbers are accepted only when they match a strict finite numeric pattern.
When pure mass exceeds sample mass—for instance a transcription error that swapped fields—the tool still returns a percentage above one hundred with an explicit note instead of clamping, so automated tests can catch data-entry bugs. This landing targets people searching for a percent purity calculator, purity percentage from sample mass, or pure substance over sample online; it is not a mass-percent solution calculator, not a percent-yield tool, and not a karat-gold converter.
Prefer this capability when you already have both masses and only need the purity figure; if your source is a word problem with volumes or moles, convert to mass first.
What you can do with it
Homework checks for sample purity
Students enter pure and sample masses from textbook purification problems and compare hand-written percent purity and purity fraction against a deterministic result before submitting.
Lab assay and batch verification
Technicians verify that a weighed pure product versus total sample matches the target purity on the certificate of analysis without opening a spreadsheet for each check.
FAQ
What is percent purity?
Percent purity is (mass of pure substance / mass of sample) × 100. It reports how much of the sample’s mass is the desired pure compound.
Is this the same as mass percent or percent yield?
No. Mass percent is solute over solution mass for concentration; percent yield is actual over theoretical product mass. Percent purity is pure substance over total sample mass.
Can percent purity exceed 100%?
Yes, if pure mass is entered larger than sample mass (usually a data error).
Is the percent purity calculator free?
The browser tool is free and runs locally.
Do I divide by the impurity mass or the whole sample?
By the whole sample, impurities included. Dividing by the impurity mass alone is a common homework trap and gives a figure that means nothing. The pure substance goes on top and the total sample mass underneath.
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/percent-purity \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"pure_mass":4.85,"sample_mass":5}'const res = await fetch("https://api.kit.forhosting.com/chem/percent-purity", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"pure_mass": 4.85,
"sample_mass": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/percent-purity",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"pure_mass": 4.85,
"sample_mass": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/percent-purity", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"pure_mass":4.85,"sample_mass":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"pure_mass":4.85,"sample_mass":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/percent-purity", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"pure_mass": 4.85,
"sample_mass": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.percent_purity",
"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_abs | 1000000000000 |
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
When sample mass is zero the percentage is undefined, so the API returns a clear invalid_input error instead of Infinity or a silent NaN.
How to call the API and what comes back
Pure mass must be non-negative; sample mass must be strictly positive—values at or below one times ten to the minus fifteen, or any non-positive sample mass, are treated as zero and rejected. If pure mass exceeds sample mass the percentage can exceed one hundred and the message notes that explicitly so bad bookkeeping is visible. Send a JSON body with two required finite numbers: pure_mass (aliases mass_pure, m_pure, pure, pure_substance_mass, grams_pure) and sample_mass (aliases mass_sample, m_sample, sample, total_sample_mass, total_mass). Absolute values must stay within the published limit of one trillion so intermediate ratios remain finite in IEEE double precision on the Worker and in the browser. On success the response echoes rounded pure_mass and sample_mass, sets percent_purity to the rounded percentage, purity_fraction to the unitless ratio pure over sample, unit to the string percent, formula to percent purity equals m_pure over m_sample times one hundred, message to a short English summary, and steps to an ordered array of substitution lines. Failed validation—missing fields, non-finite numbers, values outside absolute limits, negative pure mass, or zero sample mass—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
For teaching, pair examples: four point eight five grams of pure product in a five gram sample yields ninety-seven percent; twelve grams pure in fifteen grams sample yields eighty percent; and sample mass zero demonstrates the hard invalid_input path that protects division by zero. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when learners deliberately set sample mass to zero. Round-trip checks are easy: recompute pure divided by sample times one hundred by hand and confirm it equals the published percent_purity within the same twelve-decimal rounding, and confirm that purity_fraction times one hundred reproduces percent_purity.
Integration use cases
Unit tests for assay software
Generate known-good purity percentages plus deliberate zero-sample-mass rejections for coding kata and API contract tests.
Technical questions
What happens when sample mass is zero?
Percent purity is undefined (division by zero). This tool returns invalid_input instead of Infinity or NaN.