Air is about 78 percent nitrogen and 21 percent oxygen, but those are mole fractions, and that matters. A mole fraction counts particles: out of every 100 particles in dry air, about 78 are nitrogen molecules, 21 are oxygen molecules and 1 is an argon atom. Count the same air by mass instead and nitrogen drops to about 75.5 percent, because an oxygen molecule is heavier than a nitrogen molecule. The two scales describe the same air and give different numbers, which is why chemistry keeps them separate. This free mole fraction calculator works out each component’s share of a mixture from the moles you enter. At the defaults, 3 mol of water and 1 mol of ethanol, the total is 4 mol, the mole fraction of water is 0.750, or 75.0 percent, and the mole fraction of ethanol is 0.250, or 25.0 percent. The fractions add up to 1.000, as they must, and the calculator checks that sum for you on every calculation.
Enter a name and a number of moles for each component. Leave the third row empty if your mixture has only two components. A row counts only when it has both a name and a number of moles, and the moles must be greater than zero. The mole fraction of a component is its moles divided by the total moles, so the fractions always add up to 1.
Enter at least one component with a name and a number of moles.
| Mixture | Component 1 | Mole Fraction 1 | Component 2 | Mole Fraction 2 | Component 3 | Mole Fraction 3 |
|---|
Eight familiar mixtures, worked out with the same formula. At the defaults, water 3 mol and ethanol 1 mol, the ethanol and water 1 mol to 3 mol row is highlighted, because its names and its fractions match what you entered. The match needs names and fractions together, not names alone, so the equal-moles ethanol and water row is not highlighted at the defaults.
Founder & CEO, Techraxy
Faiq Ur Rahman is a web designer, digital product developer, and Founder of Techraxy, a growing platform of online calculators and utility tools. He specializes in building structured, user-friendly tools focused on finance, health, conversions, productivity, and everyday problem-solving. He is passionate about developing practical digital solutions that make complex tasks simpler for users worldwide.
User Ratings:
ADVERTISEMENT
ADVERTISEMENT
A mole fraction calculator is a tool that divides the moles of each component in a mixture by the total moles of all the components. The mole fraction of component i, written Xi, equals ni divided by ntotal, where ntotal is the sum of the moles of every component. The result is dimensionless, it has no unit, because moles cancel moles, and it always lies between 0 and 1. A fraction of 1 means the sample is pure, a fraction of 0 means the component is absent, and the fractions of all the components add up to exactly 1. The idea is older than the name. John Dalton’s law of partial pressures, from the early 1800s, says that the total pressure of a gas mixture is the sum of the partial pressures of its component gases. For ideal gases, each partial pressure is the component’s mole fraction times the total pressure, so the mole fraction is the link between what a mixture is made of and the pressure it exerts. The same ratio turns up in Raoult’s law for vapour pressure, in equilibrium calculations and in any place where what matters is how many particles of each kind are present rather than how much they weigh. Mole fraction is the natural scale when particles do the work. A reaction consumes molecules one at a time, a gas exerts pressure molecule by molecule, and a vapour above a liquid depends on how many of each molecule reach the surface. Mass fraction answers a different question, how much of the weight each component supplies, and volume fraction answers a third, how much of the space each component takes. All three are legitimate, and they agree only when every component has the same molar mass, which is almost never.
Enter a name and a number of moles for each component, up to three rows. The calculator updates as soon as you change an input, and the Calculate button runs it again at any time. A row counts only when it has both a name and a number of moles: leave the third row empty if your mixture has only two components, and fill it in if you have three. The moles must be greater than zero. Read the results in order. The first row gives the total moles, the sum of everything you entered. Each component then gets its own row, with its mole fraction to three decimal places and its percentage form next to it, so 0.750 reads as 75.0 percent. A component you did not enter shows a dash instead of a number. The sum check row confirms the fractions add up to 1.000, and the formula row shows the formula used. If you start from grams rather than moles, divide each mass by its molar mass first, because moles equal mass divided by molar mass. The Molar Mass Calculator works out the molar mass for any formula. Enter the moles you get into this calculator, not the grams, because entering grams as if they were moles gives the mass fraction in disguise, not the mole fraction. The diagram shows the mixture as a round-bottom flask split into coloured layers sized by mole fraction, with the largest share at the bottom. Twenty particle dots sit inside the flask, each coloured by the layer it sits in, so when a layer boundary moves past a row of dots those dots change colour. Change any input and the layers, the labels and the dot colours all move. The Compare Mixtures tab puts eight familiar mixtures side by side, from air to vinegar to natural gas, and highlights the row whose names and fractions match what you entered, so you can see at a glance where your mixture sits among the familiar ones.
The formula is Xi equals ni divided by ntotal, where ntotal is the sum of the moles of all the components. The percentage form is the mole fraction times 100. Written out for the defaults, 3 mol of water and 1 mol of ethanol: the total is 3 plus 1, which is 4 mol. The mole fraction of water is 3 divided by 4, which is 0.750, or 75.0 percent. The mole fraction of ethanol is 1 divided by 4, which is 0.250, or 25.0 percent. Adding the fractions, 0.750 plus 0.250, gives 1.000, which is the sum check the calculator shows. The sum is not a coincidence. Every mole in the total belongs to exactly one component, so adding the fractions gives the total moles divided by the total moles, which is 1. That is why the sum check is useful: if your fractions do not add to 1, something went wrong in the arithmetic, not in the chemistry. Note that the displayed fractions are rounded to three decimal places, so three displayed values can sum to 0.999 or 1.001 by rounding, as with three equal thirds at 0.333 each, while the exact fractions still sum to exactly 1.000.
Take air, simplified to 78 mol of nitrogen, 21 mol of oxygen and 1 mol of argon. The total is 78 plus 21 plus 1, which is 100 mol. The mole fraction of nitrogen is 78 divided by 100, which is 0.780, or 78.0 percent. The mole fraction of oxygen is 21 divided by 100, which is 0.210, or 21.0 percent. The mole fraction of argon is 1 divided by 100, which is 0.010, or 1.0 percent. The fractions add up to 0.780 plus 0.210 plus 0.010, which is 1.000. The precise dry-air composition, from the LibreTexts atmospheric composition table, is nitrogen 0.7808, oxygen 0.2095 and argon 0.0093, with carbon dioxide at about 0.0004 making up most of the rest. The simplified 78, 21 and 1 mix rounds those to 0.780, 0.210 and 0.010, which is why the worked example and the compare table use the rounded values, and the difference is less than a tenth of a percent on any component. The same steps check a second case. Mix 1 mol of ethanol with 3 mol of water: the total is 4 mol, the mole fraction of ethanol is 1 divided by 4, which is 0.250, and the mole fraction of water is 3 divided by 4, which is 0.750. Enter those numbers and the compare table highlights the ethanol and water 1 mol to 3 mol row, because its names and its fractions match what you entered.
The first benefit is getting the composition right when the scale matters. A mixture that is 50 percent ethanol by mass is not 50 percent ethanol by moles, because ethanol at 46.07 grams per mol is much heavier than water at 18.02 grams per mol. Fifty grams of each gives about 1.09 mol of ethanol and 2.78 mol of water, so the mole fraction of ethanol is only about 0.281. Using the mass share as if it were the mole share would overstate the ethanol by nearly a factor of two, and the error grows wherever the molar masses differ most. The second benefit is reading gas mixtures straight off the mole fraction. For an ideal gas mixture, the mole fraction is the partial-pressure fraction: at a total pressure of 1 atmosphere, the nitrogen in air, at a mole fraction of 0.780, exerts a partial pressure of 0.780 atmospheres. Divers use the same step in reverse, planning a nitrox mix by its oxygen fraction, and the compare table shows nitrox 32 at 0.320 oxygen and 0.680 nitrogen. The calculator gives the fraction; multiplying by the total pressure gives the partial pressure. The third benefit is the built-in sum check. Because the fractions must add to exactly 1, the check catches the two most common mistakes at once: a component left out of the total, and a mass entered where moles were needed. If the fractions do not add to 1, the total is wrong, and the calculator shows the sum on every run so the check is never skipped. The fourth benefit is seeing how little a heavy component needs to weigh to matter, or how much. Vinegar is about 5 percent acetic acid by mass, yet its mole fraction of acetic acid is only about 0.012, because acetic acid at 60.05 grams per mol is more than three times as heavy as water, and there are roughly 85 water molecules for every acetic acid molecule. The same counting explains why a trace gas can dominate a reaction while barely registering on a scale.
Divide the moles of the component by the total moles of all the components: Xi equals ni divided by ntotal. For 3 mol of water and 1 mol of ethanol, the total is 4 mol, so the mole fraction of water is 3 divided by 4, which is 0.750, and the mole fraction of ethanol is 1 divided by 4, which is 0.250. If you start from masses, convert each mass to moles first by dividing by its molar mass, then apply the same formula.
Yes, always, for a complete list of components. Every mole in the total belongs to exactly one component, so adding the fractions gives the total moles divided by the total moles, which is 1. If your fractions do not add to 1, a component is missing from the total, or a mass was entered where moles were needed. The displayed values are rounded to three decimal places, so three displayed values can sum to 0.999 or 1.001 by rounding, while the exact fractions still sum to exactly 1.000.
Mole fraction counts particles, mass fraction weighs them, and volume fraction measures the space they take. For the same mixture the three numbers differ whenever the components have different molar masses or densities. Dry air is 0.7808 nitrogen by mole but only about 0.7551 by mass, because oxygen molecules are heavier than nitrogen molecules. Use mole fraction when particles do the work, as in gas pressure and chemical reactions, mass fraction when weighing ingredients, and volume fraction when mixing liquids by volume.
For an ideal gas mixture, the partial pressure of a gas equals its mole fraction times the total pressure, which is Dalton’s law. At a total pressure of 1 atmosphere, oxygen in air, at a mole fraction of 0.210, has a partial pressure of 0.210 atmospheres. The step needs ideal-gas behaviour, which holds well for ordinary gases at ordinary pressures and temperatures, and breaks down at high pressure or low temperature, where real gases deviate from the ideal gas law.
The calculator gives a mole fraction of 1.000, or 100.0 percent, which is the correct answer, not an error. A single component means the sample is pure, so all of the moles belong to it and its fraction is the total divided by itself. The diagram shows a single layer filling the whole flask, and the sum check still reads 1.000.
Wikipedia — Mole fraction, with the definition as the amount of a constituent divided by the total amount of all constituents, the dimensionless character, the sum to 1, and the relation to partial pressure by Dalton’s law.
LibreTexts — Composition of Solutions, with the worked vinegar example, 3.78 g of acetic acid per 100.0 g of solution giving a mole fraction of 0.0116 for acetic acid, and the definition of mole fraction for solutions.
LibreTexts — Atmospheric Composition, with the dry-air mixing ratios, nitrogen 0.7808, oxygen 0.2095 and argon 0.0093, and the mixing ratio defined as moles of a gas divided by total moles of air.
Khan Academy — Dalton’s law of partial pressure, with the mole fraction defined as moles of a gas divided by total moles of gas, and the partial pressure as the mole fraction times the total pressure, for gases approximated as ideal.
Wikipedia — Nitrox, with Nitrox 32 defined as 68 percent nitrogen and 32 percent oxygen, the most common recreational diving mix alongside Nitrox 36.
This calculator works out mole fractions from the moles you enter, and it is for study, homework and general reference only. The arithmetic is exact, but the numbers are only as good as the moles you enter: check that you entered moles, not grams, and that every component of the mixture is listed, because a missing component changes every fraction. The compare-table mixtures are standard or typical values, rounded to three decimal places: real natural gas varies from well to well, real vinegar varies from about 4 to 8 percent acetic acid, and real air carries a variable amount of water vapour that dry-air figures exclude. The Dalton’s law step, turning a mole fraction into a partial pressure, holds for ideal gases and is an approximation for real gases, most so at high pressure or low temperature. Do not use the result for diving, medical gas mixing or any safety-critical mixture without the proper training and the proper instruments.
Last updated: 1 December 2026
ADVERTISEMENT
ADVERTISEMENT