# Solution, Gas Law & pH Calculator > Molarity, dilution, mass ↔ moles ↔ particles, ideal gas with partial pressures, pH and buffers. One calculator for the everyday quantities of solution chemistry, with units you type yourself (250 mL, 0.1 M, 25 °C, 1 atm): molarity from mass and volume or any of the three from the other two, dilutions with C1·V1 = C2·V2, mass, moles and particles of a formula, the ideal gas law solved for any variable with Dalton partial pressures of a mixture, and the pH of strong and weak acids and bases (exact quadratic and full charge balance) and of buffers (Henderson–Hasselbalch checked against the exact result). Part of the Proofline math notebook. Part of usefulweb.app (https://usefulweb.app/). Part of [Proofline](https://proofline.usefulweb.app/) (ownerApp: proofline). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://prooflinesolutioncalculator.usefulweb.app/ (interactive tool at https://prooflinesolutioncalculator.usefulweb.app/tool) - JSON API: POST https://prooflinesolutioncalculator.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://prooflinesolutioncalculator.usefulweb.app/api/v1/tool) - OpenAPI: https://prooflinesolutioncalculator.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://prooflinesolutioncalculator.usefulweb.app/mcp - tool `proofline_solution_calculator` ## Inputs - mode (select): Calculation - formula (text): Formula of the solute or gas - Gives the molar mass for conversions between mass and moles (molarity, amount, gas). - molarMass (number): Molar mass (instead of a formula) - solute (text): Solute (mass or amount) - Molarity: leave exactly one of solute, volume and concentration empty — that one is calculated. - volume (text): Volume of solution - Molarity: the final volume of the solution in L, mL, µL, dm3 or cm3. - concentration (text): Concentration - Molarity: M, mM, µM, mol/L or g/L. - c1 (text): C1 (stock concentration) - v1 (text): V1 (volume of stock) - c2 (text): C2 (final concentration) - v2 (text): V2 (final volume) - Dilution: leave exactly one of C1, V1, C2 and V2 empty. - quantity (text): Quantity - A mass (g), an amount (mol) or a number of particles (1.5e23 molecules). - pressure (text): Pressure - Pa, kPa, bar, atm, mmHg, torr or psi. Gas law: leave exactly one of pressure, volume, amount and temperature empty. - gasVolume (text): Volume of gas - L, mL or m3. - temperature (text): Temperature - K, °C or °F. - gasAmount (text): Amount of gas - mol, or a mass with the formula. Leave empty to use the sum of the mixture. - mixture (textarea): Gas mixture (optional) - Each gas with an amount or a mass: mole fractions and partial pressures (Dalton’s law). - solutionType (select): Solution - phConcentration (text): Acid or base concentration - pH: the concentration of the acid or base; for a buffer the concentration of the weak acid HA. M, mM or mol/L. - constant (text): Ka, pKa, Kb or pKb - A bare number is Ka for acids and buffers and Kb for bases; write pKa 4.76 or Kb 1.8e-5 to be explicit. - conjugate (text): Conjugate base concentration (buffer) - equivalents (integer): H⁺ or OH⁻ per formula unit (strong) - For example 2 for Ba(OH)2. ## Method - Quantities are read with their units and converted to mol, g, L, Pa and K. Molar masses come from the formula (CIAAW standard atomic weights) or the number you give. - Molarity c = n / V with V the final volume of solution; dilution conserves the solute, C1·V1 = C2·V2; particles N = n·N_A with the exact Avogadro constant. - Ideal gas: p·V = n·R·T with the exact molar gas constant R = 8.314462618… J/(mol·K), solved for the empty quantity. Mixtures: mole fractions xᵢ = nᵢ / n and partial pressures pᵢ = xᵢ·p (Dalton). - pH at 25 °C with Kw = 1.0 × 10⁻¹⁴: strong acids and bases from the charge balance [H⁺] = c + Kw/[H⁺]; weak acids and bases from the textbook quadratic x² + K·x − K·c = 0 and from the full charge balance including water, solved by bisection; the shortcut √(K·c) is shown with the 5 % check. Buffers: Henderson–Hasselbalch pKa + log([A⁻]/[HA]) next to the exact charge balance [H⁺] + c(A⁻) = [A⁻] + [OH⁻]. ## Limits - Dilute-solution model: activities are taken as concentrations, so pH values above about 0.1 M ionic strength and below pH 1 are approximate. Real gases deviate from the ideal gas law at high pressure. Nothing here is advice on handling chemicals safely.