What is mole fraction?
Mole fraction is the simplest way to say how much of a mixture is one component: the moles of that component divided by the total moles of everything in the mixture. It has no unit, it is always between 0 and 1, and the mole fractions of all the components add up to exactly 1. A mixture that is 0.4 of A and 0.6 of B is 40 percent A and 60 percent B by moles.
This calculator works out the mole fractions of a two-component mixture. Type the moles of each component and it shows both mole fractions and the total moles. It is a short calculation, but it is the input to Dalton's law of partial pressures, to Raoult's law, and to any problem that asks how a mixture behaves when its composition changes.
The share and print buttons sit with every tool on this site. Share sends the page link, not your numbers, so whoever opens it starts from the same defaults you saw. Print gives you a clean copy for a lab notebook, a recipe folder, or a classroom handout, with the formula and the worked example included.
Students use tools like this one for homework and exam practice, teachers use them to check answers quickly in class, and working cooks and lab staff use them because a fast, correct conversion beats doing the same arithmetic by hand for the twentieth time. The tool does not replace understanding the method — it removes the arithmetic so the understanding is what you spend your time on.
How mole fractions are calculated
The method is one division per component. Add the moles of A and B to get the total moles, then divide each component's moles by that total. Two moles of A and three moles of B give five moles in total, so A's mole fraction is 2 divided by 5, or 0.4, and B's is 3 divided by 5, or 0.6. The two fractions add to 1, which is the check that the arithmetic is right.
Mole fraction is dimensionless — it is a ratio of moles to moles, so the units cancel. That is also why it is so useful in gas problems: at a given temperature and pressure, the mole fraction of a gas equals its share of the total pressure and its share of the total volume. The same number does three jobs, which is why textbooks keep coming back to it.
The constants used on this page are the standard values taught in textbooks: the gas constant, Avogadro's number, and the atomic masses from the standard periodic table. They are stated where they are used, so you can check them against your own textbook and see that they match. If your course uses a rounded constant — 22.4 litres per mole at STP, for example — the difference from the precise value is small, and it is noted in the worked example.
The answers on this page are rounded for display, usually to two decimal places, while the maths underneath keeps full precision. That means a result shown as 2.28 may really be 2.2814, and the reverse check may differ in the last digit for the same reason. That is rounding, not an error, and it never changes the answer by more than a fraction of a percent.
Total moles: the input that matters
The input people get wrong is the total. The denominator is the total moles of all components, not the moles of the other component — A's mole fraction is A's moles over the total, not A's moles over B's moles. Dividing 2 by 3 gives 0.67, which is a ratio, not a mole fraction, and it does not add up to 1 with anything.
The second trap is using masses instead of moles. Two grams of hydrogen and three grams of oxygen are not a 0.4 and 0.6 mixture, because a mole of hydrogen weighs about 2 grams and a mole of oxygen weighs about 32. Convert each mass to moles first — with the mole calculator — and only then work out the fractions.
The most common mistake with any calculator is typing a number and trusting it without a glance at the label beside it. The second is copying a result with more digits than the inputs justify — if your inputs are good to two digits, the answer is good to two digits, however many the screen shows. Round the answer to match the precision of what you measured.
A worked example: two moles and three moles
Take the default example. You have 2 moles of A and 3 moles of B, so the total is 5.00 moles. A's mole fraction is 2 divided by 5, which is 0.400, and B's is 3 divided by 5, which is 0.600. Add them: 0.400 plus 0.600 is 1, exactly as it should be.
As percentages, that is 40 percent A and 60 percent B by moles — multiply each mole fraction by 100. If this were a gas mixture at a total pressure of 1 atmosphere, A's partial pressure would be 0.4 atmospheres and B's 0.6, which is Dalton's law in action and the reason mole fractions show up in gas problems so often.
Before you rely on a result, run a quick sanity check on it. Convert a value you already know — one large egg should come out near 57 grams, one mole of water near 18 grams — and see that the tool agrees. If it does, your inputs are right and the rest of the answers will be too. If it does not, the input is usually the problem, not the tool.
The one habit that prevents nearly every wrong answer here is checking the units before you trust the result. Grams are not ounces, millilitres are not cups, and a value typed in the wrong unit gives a confident-looking wrong answer. Read the label next to each box, match it to the unit on your recipe or your lab sheet, and only then read the result.
Why mole fractions matter
Students use mole fractions in gas-mixture problems, in vapour-pressure problems, and in any question about the composition of a solution. They are the natural unit for mixtures because they connect directly to partial pressures and to the number of particles of each kind present.
In industry, gas mixtures are specified by mole fraction — breathing gas, welding gas, and calibration gas are all sold by composition in mole percent, because the mole fraction is what decides the partial pressure at any total pressure. A diving gas that is 32 percent oxygen by moles is 32 percent oxygen at any depth, which is the number that matters for safety.
This site has a full set of related tools, and the links in this article point to the ones people reach for next. They all work the same way — type your numbers, read the answer, nothing uploaded — so once you know one of them, you know all of them. The "More free tools" section at the bottom of the page lists three close neighbours.
Everything on this page runs in your browser. Nothing you type is uploaded, stored, or sent to a server, and there is no account to create and no sign-up step. You can use the tool as many times as you like, close the tab, and come back later — your inputs are never saved anywhere.
Two related tools worth knowing are the ideal gas law calculator and density calculator.
Mole fraction vs percentage composition
Percentage composition by mass, on the percentage calculator, answers a different question: what share of the mass is one element, not what share of the moles. A mixture can be 40 percent A by moles and a very different percent by mass, because the components have different molar masses. Use mole fraction for counting particles and pressure; use mass percent for weighing and analysis.
A mole calculator converts a single mass to moles, which is the step before mole fractions can be worked out. If your mixture is given in grams, convert each component to moles first, then bring the mole numbers here.
This site has a full set of related tools, and the links in this article point to the ones people reach for next. They all work the same way — type your numbers, read the answer, nothing uploaded — so once you know one of them, you know all of them. The "More free tools" section at the bottom of the page lists three close neighbours.
Common mistakes with mole fractions
The most common mistake is dividing by the other component's moles instead of the total, which gives a ratio rather than a fraction. The second is using masses in place of moles. The third is forgetting that the fractions must add to 1 — if they do not, something is wrong, and the total is the first place to look.
A fourth mistake is treating mole fraction as a percentage without multiplying by 100 — 0.4 is 40 percent, not 0.4 percent. A fifth is rounding the fractions so they no longer add to 1: keep three decimals until the end, then round, and let the last component take the rounding difference if the sum must be exact.
The most common mistake with any calculator is typing a number and trusting it without a glance at the label beside it. The second is copying a result with more digits than the inputs justify — if your inputs are good to two digits, the answer is good to two digits, however many the screen shows. Round the answer to match the precision of what you measured.
How to use this mole fraction calculator
Type the moles of component A and the moles of component B. Both mole fractions appear instantly, with the total moles alongside. Change any number and the answers update at once.
If your mixture is given in grams, convert each mass to moles first — divide by the molar mass — and type the moles here. And always check that the two fractions add to 1; if they do not, the total is wrong.
The share and print buttons sit with every tool on this site. Share sends the page link, not your numbers, so whoever opens it starts from the same defaults you saw. Print gives you a clean copy for a lab notebook, a recipe folder, or a classroom handout, with the formula and the worked example included.