{
  "id": "mole-fraction",
  "version": "fc4d526c3f18",
  "status": "published",
  "name": "Mole Fraction Calculator",
  "question": "What is the mole fraction?",
  "summary": "Finds the mole fraction and mole percent of each component of a mixture or solution from its moles, or from its mass and molar mass: X = moles of the component ÷ total moles.",
  "category": "chemistry",
  "subcategory": "solutions",
  "url": "https://www.acalculator.org/chemistry/mole-fraction-calculator",
  "markdown": "https://www.acalculator.org/chemistry/mole-fraction-calculator.md",
  "kind": "function",
  "method": "X_A = n_A ÷ (n_A + n_B + …), where each n is typed in moles or is mass (g) ÷ molar mass (g/mol); mole percent = 100 × X.",
  "assumptions": [
    "Every component of the mixture is listed; the fractions add up to 1.",
    "A row with moles uses them; a row without moles needs both its mass and its molar mass."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "parts": {
        "title": "Components",
        "description": "One row per component: its name, and its moles or its mass in grams with its molar mass in g/mol.",
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "c": {
              "title": "Name",
              "description": "A name for the component, such as water.",
              "type": "string",
              "maxLength": 40
            },
            "n": {
              "title": "Moles",
              "description": "The amount of the component in moles.",
              "type": "number",
              "minimum": 1e-15,
              "maximum": 1000000000000
            },
            "g": {
              "title": "Mass (g)",
              "description": "The mass of the component in grams, used when moles are empty.",
              "type": "number",
              "minimum": 1e-12,
              "maximum": 1000000000000
            },
            "mm": {
              "title": "Molar mass (g/mol)",
              "description": "The molar mass of the component, used with the mass.",
              "type": "number",
              "minimum": 0.000001,
              "maximum": 1000000
            }
          }
        }
      }
    }
  },
  "outputs": {
    "result": {
      "label": "Mole fraction of the first component",
      "description": "X of the first row, to 6 significant figures.",
      "format": "text"
    },
    "first": {
      "label": "X (first component)",
      "description": "The mole fraction of the first row.",
      "format": "number"
    },
    "percent": {
      "label": "Mole percent (first component)",
      "description": "The first row’s mole fraction × 100.",
      "format": "number"
    },
    "all": {
      "label": "Every component",
      "description": "Each component’s mole fraction and mole percent.",
      "format": "text"
    },
    "moles": {
      "label": "Moles of each",
      "description": "Each component’s amount in moles.",
      "format": "text"
    },
    "total": {
      "label": "Total moles",
      "description": "The moles of all the components added up.",
      "format": "number"
    },
    "firstName": {
      "label": "First component",
      "description": "The name of the first row.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "parts": [
        {
          "name": "Ethylene glycol",
          "g": 2220,
          "mm": 62.07
        },
        {
          "name": "Water",
          "g": 2000,
          "mm": 18.02
        }
      ]
    },
    "outputs": {
      "result": "X = 0.243715",
      "first": 0.24371468048864292,
      "percent": 24.371468048864294,
      "all": "Ethylene glycol: 0.243715 (24.3715%); Water: 0.756285 (75.6285%)",
      "moles": "Ethylene glycol: 35.7661 mol; Water: 110.988 mol",
      "total": 146.75386190844284,
      "firstName": "Ethylene glycol"
    },
    "text": "The mole fraction of Ethylene glycol is 0.243715."
  },
  "examples": [
    {
      "given": {
        "parts": [
          {
            "name": "Ethylene glycol",
            "g": 2220,
            "mm": 62.07
          },
          {
            "name": "Water",
            "g": 2000,
            "mm": 18.02
          }
        ]
      },
      "expect": {
        "first": 0.24371468048864292,
        "result": "X = 0.243715"
      },
      "source": "OpenStax, Chemistry 2e, §11.4 Colligative Properties (mole fraction X_A = mol A ÷ total mol of all components), https://openstax.org/books/chemistry-2e/pages/11-4-colligative-properties, Example 11.3 (a): X(ethylene glycol) = 0.244; Python 3"
    },
    {
      "given": {
        "parts": [
          {
            "name": "Ammonia",
            "g": 0.85,
            "mm": 17.03
          },
          {
            "name": "Water",
            "g": 125,
            "mm": 18.02
          }
        ]
      },
      "expect": {
        "first": 0.007143899887456875
      },
      "source": "OpenStax, Chemistry 2e, §11.4 Colligative Properties (mole fraction X_A = mol A ÷ total mol of all components), https://openstax.org/books/chemistry-2e/pages/11-4-colligative-properties, Check Your Learning after Example 11.3: X(NH₃) = 7.14 × 10⁻³; Python 3"
    },
    {
      "given": {
        "parts": [
          {
            "name": "Ethanol",
            "n": 4
          },
          {
            "name": "Glycerin",
            "n": 1
          }
        ]
      },
      "expect": {
        "first": 0.8,
        "all": "Ethanol: 0.8 (80%); Glycerin: 0.2 (20%)",
        "total": 5
      },
      "source": "OpenStax, Chemistry 2e, §11.4 Colligative Properties (mole fraction X_A = mol A ÷ total mol of all components), https://openstax.org/books/chemistry-2e/pages/11-4-colligative-properties, Example 11.6: 4.000 mol ethanol and 1.00 mol glycerin, X(ethanol) = 0.800"
    },
    {
      "given": {
        "parts": [
          {
            "name": "Oxygen",
            "n": 2.83
          },
          {
            "name": "Nitrous oxide",
            "n": 8.41
          }
        ]
      },
      "expect": {
        "first": 0.251779359430605,
        "percent": 25.177935943060497
      },
      "source": "OpenStax, Chemistry 2e, §9.3 Stoichiometry of Gaseous Substances, Mixtures, and Reactions (X_A = n_A ÷ n_Total), https://openstax.org/books/chemistry-2e/pages/9-3-stoichiometry-of-gaseous-substances-mixtures-and-reactions, Example 9.15: X(O₂) = 2.83 ÷ 11.24 = 0.252; Python 3"
    }
  ],
  "sources": [
    "OpenStax, Chemistry 2e, §11.4 Colligative Properties: mole fraction X_A = mol A ÷ total mol of all components, Example 11.3 (2.22 × 10³ g ethylene glycol in 2.00 × 10³ g water: X = 0.244) and its Check Your Learning (0.850 g NH₃ in 125 g water: 7.14 × 10⁻³), Example 11.6 (4.000 mol ethanol and 1.00 mol glycerin: X(ethanol) = 0.800, 0.142 atm). https://openstax.org/books/chemistry-2e/pages/11-4-colligative-properties (retrieved 2026-10-19)",
    "OpenStax, Chemistry 2e, §9.3 Stoichiometry of Gaseous Substances, Mixtures, and Reactions: X_A = n_A ÷ n_Total, P_A = X_A × P_Total, Example 9.15 (2.83 mol O₂ and 8.41 mol N₂O: X(O₂) = 0.252). https://openstax.org/books/chemistry-2e/pages/9-3-stoichiometry-of-gaseous-substances-mixtures-and-reactions (retrieved 2026-10-19)"
  ],
  "related": [
    "partial-pressure",
    "molality",
    "molarity",
    "molar-mass"
  ],
  "changelog": []
}
