Mole Fraction Calculator – Count Particles, Not Grams
The mole fraction of a component is its share of all the particles in a mixture. This calculator works it out for 2 to 10 components from whatever you measured: grams, moles, millilitres of a liquid or litres of a gas. It also converts a composition between mass %, mol % and ppm, and turns a molality or molarity into a mole fraction. Every result comes with a step-by-step derivation and two pictures of the mixture.
The mole fraction formula
n_i = m_i / M_i (mass → moles)
x_i = n_i / Σ n_j (mole fraction, Σ x_i = 1)
mol %_i = 100 · x_iMole fraction is dimensionless: moles divided by moles. IUPAC writes x for liquids and solids and y for gases, but the arithmetic is the same. Because every component is a share of one total, the fractions always add up to exactly 1, which the results table prints as a check.
Why mole fraction counts particles, not mass
Mix 50 mL of ethanol with 50 mL of water. The ethanol weighs about 39.5 g and the water about 49.9 g, so ethanol is roughly 44 % of the mass. But an ethanol molecule (46.07 g/mol) is more than twice as heavy as a water molecule (18.02 g/mol), so the same mass holds far fewer molecules. Counted by particles, ethanol is only about 24 % of the molecules: x_ethanol ≈ 0.236.
The rule is general. A light component such as water, hydrogen or helium makes up a bigger share of the molecules than of the mass, and a heavy component makes up a smaller share. The "share of molecules vs share of mass" bars above draw this as ribbons that narrow or widen between the two bars.
Converting mass % to mole fraction
To go from a mass basis to a mole basis, divide each mass fraction by its molar mass and renormalise. Going the other way, multiply by the molar mass:
x_i = (w_i / M_i) / Σ (w_j / M_j)
w_i = x_i·M_i / Σ (x_j·M_j)
M̄ = Σ x_i·M_i (mean molar mass)For example, 37 % w/w hydrochloric acid is only x_HCl ≈ 0.225, and dry air (78.08 mol % N₂, 20.95 % O₂, 0.93 % Ar, 0.04 % CO₂) has a mean molar mass of about 28.97 g/mol. Mark the last row as the balance to type "3.5 % NaCl, rest water" directly, and open the batch panel to turn a composition into masses and volumes to weigh out.
Gas mixtures and the STP trap
By Avogadro's law, equal volumes of ideal gases at the same temperature and pressure contain equal numbers of moles. So when every amount is a gas volume, volume fraction equals mole fraction and no temperature or pressure is needed. When gas volumes are mixed with grams or moles, each volume is converted with n = PV / RT.
From molality or molarity
For a solute in one solvent, a molality b gives the mole fraction directly, because 1 kg of solvent is 1000 / M_solvent moles:
x_solute = b / (b + 1000 / M_solvent)
b = 1000·c / (1000·ρ − c·M_solute) (molarity → molality)A 2.922 mol/kg aqueous solution has x_solute ≈ 0.0500. Molarity needs the solution's density as well, since a litre of solution contains an unknown mass of solvent otherwise.
Formula units vs dissolved particles
Standard mole fractions count formula units: one NaCl counts once. For colligative effects such as vapour-pressure lowering, what matters is the number of dissolved particles, so the optional "count dissolved ions" switch multiplies each amount by its particle factor i (2 for NaCl, 3 for CaCl₂). This assumes complete dissociation; real electrolytes dissociate less as concentration rises.
Where mole fractions are used
- Raoult's law: the vapour pressure of each component is
p_i = x_i·p_i*. - Dalton's law: the partial pressure of a gas is
p_i = y_i·P_total. - Colligative properties: vapour-pressure lowering, and through molality, freezing point depression and boiling point elevation.
- Thermodynamics: mixing entropy and Gibbs energy are written in terms of
x ln x.