Mole Fraction Calculator

Compute mole fractions x_A and x_B of a two-component mixture.

Science 2 modes Two components Mol %
Rate this calculator · 3.5 (2)

Mole Fraction Calculator

x_i = n_i / sum(n) - 2 components

Instructions — Mole Fraction Calculator

Mole fraction is the ratio of one component's moles to the total moles in a mixture.

  1. Moles mode: enter the moles of A and B directly. The calculator divides each by the total.
  2. Mass + molar mass mode: enter the mass and molar mass of each component. The calculator converts to moles before computing fractions.

The output shows the mole fractions x_A and x_B (each between 0 and 1, summing to 1) and the equivalent mole percent (each between 0% and 100%, summing to 100%).

Formulas

Definition:

$$ x_i = \frac{n_i}{\sum_j n_j} = \frac{n_i}{n_{total}} $$

From masses and molar masses:

$$ x_i = \frac{m_i / M_i}{\sum_j (m_j / M_j)} $$

Sum constraint (binary mixture):

$$ x_A + x_B = 1 $$

Mole percent:

$$ \text{mol\%}_i = 100 \cdot x_i $$

Dalton's law of partial pressures (for gas mixtures):

$$ P_i = x_i \cdot P_{total} $$

Raoult's law (ideal solution vapor pressure):

$$ P_i = x_i \cdot P_i^* $$

Reference

Mole fractions of major air components (dry air, sea level):

ComponentMole fractionMol %
N20.780878.08
O20.209520.95
Ar0.009340.934
CO20.000420.042
Ne0.00001820.00182
He0.00000520.00052

Mole fraction vs mass fraction (water + ethanol blend):

Mass % ethanolMole fraction ethanol
10%0.042
40%0.207
50%0.281
70%0.476
96%0.904

Article — Mole Fraction Calculator

Mole Fraction Calculator: x_i = n_i / sum(n)

Mole fraction (x_i) is the ratio of moles of one component to the total moles in a mixture. It is dimensionless, runs from 0 to 1, and sums to exactly 1 across all components. For a binary mixture, x_A + x_B = 1, so knowing one fixes the other. Mole fraction is the natural composition unit for gases (Dalton's law) and ideal solutions (Raoult's law).

Unlike mass fraction or molarity, mole fraction does not change with temperature or pressure. It is a pure composition number, set the moment the mixture is prepared.

What mole fraction measures

Mole fraction counts particles. Whether the particles are atoms, molecules, or ions does not matter; what matters is the ratio of one count to the total count. A mixture of 2 mol N2 and 0.8 mol O2 has mole fractions x_N2 = 2 / 2.8 = 0.714 and x_O2 = 0.8 / 2.8 = 0.286. They sum to 1, as they must.

Because the unit is a pure ratio, no joules, no kelvins, no liters need to enter the calculation. The mole fraction of N2 in dry air is 0.7808 today and was 0.7808 a million years ago. Adding more nitrogen would change it, but heat, pressure, and altitude do not.

The mole fraction formula

Mole fraction shortcuts
x_i = n_i / sum(n) definition
x_A + x_B = 1 binary constraint
mol % = 100 · x percent form
P_i = x_i · P_total Dalton's law
P_i = x_i · P_i* Raoult's law

The formula is one division. When starting from masses, first convert each mass to moles: n_i = m_i / M_i. The mole-fraction step is the same regardless of how the moles were obtained.

Mole fraction versus mass fraction

Mass fraction (w_i = m_i / total mass) and mole fraction give different numbers whenever the molar masses differ. A 50/50 mass blend of water (M = 18) and ethanol (M = 46) is mostly water on a molar basis: x_water = 0.72, x_ethanol = 0.28. The lighter molecule contributes more moles per unit mass, so it wins the mole-fraction count.

MixtureMass fractionMole fraction
50/50 water + ethanol0.50 each0.72 water / 0.28 ethanol
50/50 H2 + O2 (gas)0.50 each0.94 H2 / 0.06 O2
50/50 NaCl + KCl0.50 each0.56 NaCl / 0.44 KCl
Did you know

The 21% oxygen "by volume" reported for Earth's atmosphere is actually a mole fraction. For ideal gases, mole fraction equals volume fraction because equal moles occupy equal volumes at the same T and P (Avogadro's law). For liquids and solids the equality breaks down: molar volumes differ widely.

Mole fraction and Dalton's law

Dalton's law of partial pressures: in an ideal gas mixture, the partial pressure of each component is its mole fraction times the total pressure. P_i = x_i · P_total. At sea level with total pressure 1 atm, oxygen contributes P_O2 = 0.21 atm; nitrogen contributes 0.78 atm; carbon dioxide contributes 0.00042 atm.

This is the basis of every gas-mixture problem. Anesthesia, scuba diving (nitrox blends), industrial gas welding, and atmospheric chemistry all hinge on partial pressures, which start from mole fractions.

Mole fraction and Raoult's law

Raoult's law: in an ideal solution, the vapor pressure of each component above the liquid is its mole fraction in the liquid times the pure-component vapor pressure. P_i = x_i · P_i*. A solute lowers the vapor pressure of the solvent by reducing the mole fraction of solvent below 1.

Raoult's law is the basis of fractional distillation: vapor enriches in the more volatile component (higher P_i*) at each stage, while liquid enriches in the less volatile one. Crude-oil refining columns and ethanol stills both rely on this mole-fraction relationship.

Common mole fractions in nature

  • N2 in dry air: x = 0.7808
  • O2 in dry air: x = 0.2095
  • Ar in dry air: x = 0.00934
  • CO2 in dry air (2024): x = 0.000421 (~421 ppm)
  • Water in seawater (1.1 m salt): x = 0.980
  • Hemoglobin O2 saturation (arterial): x = 0.98 of binding sites occupied
  • Ethanol in 96-proof spirits: x = 0.20 (about 48 vol%)

Where mole fraction matters

Atmospheric science. All gas-concentration measurements in climate science (CO2 at 421 ppm, methane at 1.9 ppm) are mole fractions. The "ppm" stands for parts per million of moles of gas, not parts of mass. A doubling of atmospheric CO2 mole fraction from preindustrial 280 ppm to a projected 560 ppm is the headline metric in every IPCC report.

Petroleum refining. A crude distillation column has dozens of stages; at each one, the vapor enriches in lighter hydrocarbons by Raoult's law. The mole-fraction profile from top (light naphtha and gasoline) to bottom (heavy residue and asphalt) is the design output of the entire refinery. Process engineers track mole fractions of fifty or more distinct hydrocarbons through every tray.

Biophysics. Oxygen binding to hemoglobin is described by mole fractions of bound versus unbound binding sites. Cooperativity (the Hill curve) emerges from these mole-fraction relationships. The classic sigmoidal saturation curve plots fractional saturation (a mole-fraction) of bound oxygen against partial pressure (a mole-fraction times total pressure). Two mole-fraction quantities, one plot, the entire physiology of respiration.

Stable isotope geochemistry. The ratio of oxygen-18 to oxygen-16 in seawater, ice cores, and limestone is a mole fraction. Paleoclimatologists measure these ratios on samples millions of years old to reconstruct ancient temperatures. The standard delta notation expresses small deviations from a reference mole fraction.

Mole fraction mistakes

Volume fraction is not mole fraction (except for ideal gases)

For ideal gases, volume fraction equals mole fraction because equal moles take equal volumes at the same T and P. For liquids and solids, they are not equal: 50 mL of ethanol in 50 mL of water has volume fraction 0.5 but mole fraction only 0.28 for ethanol. The molar volumes are different.

Other regular slips: confusing mass percent with mole percent (especially in alcohol and acid concentrations), forgetting to divide by molar mass when starting from grams, treating mole fraction as concentration in mol/L (it is dimensionless), and assuming non-ideal solutions still follow Raoult's law (they don't).

Tip

For dilute solutions where one component dominates (say, x_solvent > 0.99), mole fraction of the solute is essentially equal to its molality times the solvent's molar mass divided by 1000. For water as solvent, x_solute approximately equals m / 55.5, since 1 kg of water is 55.5 mol.

FAQ

Mole fraction (x_i) is the ratio of moles of one component to the total moles in a mixture. It is dimensionless and lies between 0 and 1. The mole fractions of all components in a mixture sum to exactly 1. Mole fraction is the natural composition unit in thermodynamics and gas-mixture problems.
Divide the moles of one component by the total moles. For a two-component mixture: x_A = n_A / (n_A + n_B). If you start with masses instead of moles, first convert each mass to moles using the corresponding molar mass.
Mass fraction is the ratio of one component's mass to the total mass. Mole fraction is the ratio of moles. They are equal only when the components have the same molar mass; otherwise they differ. For 50/50 water/ethanol by mass, the mole fraction of ethanol is only 0.28 because ethanol's molar mass (46) is more than twice water's (18).
Dalton's law says that in an ideal gas mixture, the partial pressure of each component equals its mole fraction times the total pressure: P_i = x_i · P_total. In dry air at 1 atm, the partial pressure of oxygen is 0.21 atm because the mole fraction of O2 is 0.21.
For an ideal solution, the vapor pressure of each component above the liquid is its mole fraction times its pure-substance vapor pressure: P_i = x_i · P_i*. Raoult's law is the basis of fractional distillation and explains how solutes lower the vapor pressure of a solvent.
No. By construction, mole fractions are non-negative and never exceed 1. A value of 1 means a pure substance; a value of 0 means the component is absent. Mole fractions are like probabilities: they sum to 1 across all components in the mixture.
No. Mole fraction is purely a composition measure, set when the mixture is made. Temperature and pressure can change the volume or vapor pressure, but they cannot change how many moles of each species are present in the mixture.
Divide by 100. Mole percent of 21% O2 in air gives mole fraction 0.21. The two are interchangeable representations; pick whichever fits the context. Thermodynamic equations typically use the decimal fraction; informal reports often use the percent.