ForHosting KIT · Science

Mass fraction to mole fraction calculator

Turn the mass fractions of a two-part mixture into mole fractions: salt water that is 0.2 sodium chloride at 58.44 g/mol and 0.8 water at 18.015 g/mol by mass has a salt mole fraction of 0.0715519809354. 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
Solute mass fraction
0.2
Solvent mass fraction
0.8
Solute molar mass
58.44
Solvent molar mass
18.015
You get
Moles solute per unit mass
0.0034223135
Moles solvent per unit mass
0.0444074382
Total moles per unit mass
0.0478297517
Mole fraction solute
0.0715519809

Mass fraction and mole fraction both describe mixture composition, but they weight components differently: mass fraction counts grams of each species, while mole fraction counts moles. Process sheets, assay certificates, and many lab protocols report weight percent or mass fraction, yet Raoult's law, ideal-solution chemical potentials, and gas equilibrium constants need mole fraction. Converting between them requires the molar masses of the species involved. For a binary solute–solvent mixture the textbook path is to form moles per unit mass as mass fraction divided by molar mass for each component, then divide the solute moles by the total. This calculator takes the two mass fractions and the two molar masses, returns the solute mole fraction as the primary answer, and also reports the solvent mole fraction and the intermediate mole amounts so homework and audit trails stay transparent.

Where mass-to-mole conversion shows up in real work

Secondary-school and university chemistry courses assign drills that start from weight percent labels on bottles or assay sheets and ask for mole fraction before applying Raoult or colligative formulas; a single trusted oracle speeds grading without hand-waving floating-point noise. Process engineers convert plant laboratory mass assays into mole-fraction feeds for flash, distillation, and reactor models that expect x and y vectors rather than weight percent. Environmental notebooks normalize measured mass fractions of solutes in aqueous samples into mole fractions when comparing to ideal-solution partial-pressure estimates.

Materials and polymer labs report monomer feed on a mass basis from scales but need mole fractions for kinetic stoichiometry. If you later need mole fraction directly from component moles without mass data, molality from moles and solvent kilograms, automatic formula-to-molar-mass tables, or multi-component mass-fraction vectors, treat those as separate search intents and landings rather than overloading this binary mass-fraction to mole-fraction calculator page.

Process assay to simulation feed

Turn lab mass-fraction assays into mole-fraction compositions before flash, distillation, or reactor model inputs.

Colligative and VLE prep

Obtain dimensionless mole fractions from weight-percent labels before Raoult, Dalton, or freezing-point depression calculations.

What happens if a molar mass is zero?

Mole amounts divide by molar mass, so a zero M is rejected instead of returning Infinity or NaN.

Do mass fractions need to sum to one?

For a true binary they usually do (solvent ≈ 1 − solute). The formula still uses your two values as relative masses; both cannot be zero.

What units should molar masses use?

Any consistent mass-per-mole unit works (commonly g/mol). Both species must use the same unit so the ratio w/M is meaningful.

What does it cost?

The browser tool is free and runs locally.

When do I need a mole fraction instead of a mass fraction?

Whenever a formula counts particles rather than grams: Raoult's law, freezing-point depression and other colligative properties, ideal-solution chemical potentials and gas equilibria. Lab assays and labels usually give mass, so you convert first.

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-fraction-to-mole-fraction

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-fraction-to-mole-fraction \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"solute_mass_fraction":0.2,"solvent_mass_fraction":0.8,"solute_molar_mass":58.44,"solvent_molar_mass":18.015}'
{
  "solute_mass_fraction": 0.2,
  "solvent_mass_fraction": 0.8,
  "solute_molar_mass": 58.44,
  "solvent_molar_mass": 18.015
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "chem.mass_fraction_to_mole_fraction",
  "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.

Zero molar mass is rejected with a clear invalid_input error so a bad denominator never becomes Infinity or NaN.

How mass fraction converts to mole fraction

Start from a fixed basis of one unit mass of mixture. Molar masses must use consistent units, typically grams per mole when mass fractions are weight fractions of the same mixture; only the ratio of masses to molar masses matters, so any mass-per-mole unit works if both species use it. Mass fractions should be non-negative; for pure weight-percent work convert wt percent to a fraction first by dividing by one hundred. The mass of solute on that basis is the solute mass fraction w_s, and the mass of solvent is w_v. Divide each mass by the corresponding molar mass to obtain moles per unit mass: n_s equals w_s over M_s and n_v equals w_v over M_v. The solute mole fraction is then x_s equals n_s divided by the sum n_s plus n_v, which expands to the closed form x_s equals open parenthesis w_s over M_s close parenthesis over open parenthesis w_s over M_s plus w_v over M_v close parenthesis. The same construction with n_v in the numerator gives the solvent mole fraction, and for a true binary the two mole fractions sum to one. If either molar mass is zero the division is undefined, and this capability fails with invalid_input rather than inventing Infinity. The arithmetic is deterministic floating-point with no random seeds, wall-clock timestamps, or network calls, so identical inputs always produce identical JSON. This landing intentionally stays on the binary mass-to-mole conversion; multi-component tables, formula-based molar-mass lookup, molality, and molarity remain separate search intents.

What you send and what you get back

Classic textbook checks include twenty weight percent sodium chloride in water with M_s of fifty-eight point forty-four and M_v of eighteen point zero one five, equal mass ethanol–water mixtures with M near forty-six and eighteen, and a pure solvent limit where solute mass fraction is zero giving mole fraction zero. Wire the free browser form for homework and quick sanity checks, then call the identical contract from scripts when you need bulk answer keys or grading oracles. Send four required fields: solute_mass_fraction and solvent_mass_fraction as finite non-negative numbers (use 0.2 for twenty weight percent solute, and typically one minus that value for a binary solvent), plus solute_molar_mass and solvent_molar_mass as finite positive numbers in grams per mole or any consistent mass-per-mole unit. Missing fields, non-numeric strings, NaN, Infinity, negative mass fractions, negative molar masses, and zero molar mass fail with invalid_input and are not charged. If both mass fractions are zero there are no moles to normalize and the request fails the same way. On success the response echoes the cleaned four inputs, provides moles_solute_per_unit_mass, moles_solvent_per_unit_mass, and total_moles_per_unit_mass for intermediate checks, returns mole_fraction_solute as the primary dimensionless result, includes mole_fraction_solvent for convenience, attaches a units hint object, sets method to mass_fraction_to_mole_fraction, and formula to x_s equals open parenthesis w_s over M_s close parenthesis over open parenthesis w_s over M_s plus w_v over M_v close parenthesis so lab notebooks can cite the same expression. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where mass-to-mole conversion shows up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Homework weight-percent drills

Convert solute and solvent mass fractions plus molar masses into x_solute so students and auto-graders share one closed-form ground truth.

How do you convert mass fraction to mole fraction?

For a binary mixture, form moles per unit mass as w/M for each species, then x_solute = (w_s/M_s) / (w_s/M_s + w_v/M_v). Both molar masses must be positive.

Read the full KIT documentation →