Calculated osmolarity or osmolality of a solution from its components
form_osmolarity
Works out the calculated osmolarity (per litre) or osmolality (per kg of water) of a solution.
- Runs
- On the server
- Level
- Checked against a reference: exact arithmetic: Python fractions on the recorded equations, written before the engine; a second implementation in Python by a separate agent of the same model family
What it is
Returns the calculated osmolarity (per litre) or osmolality (per kg of water) of a solution. Use when summing ν·φ·c over a formulation's components on a stated basis (molarity or molality), ideal or with stated coefficients. Not for the mass to weigh for a molar stock: use `calc_molarity`; not for a recipe: use `calc_recipe`; not for tonicity adjustment: use `form_tonicity_adjustment`; not for an osmotic pressure: use `form_osmotic_pressure`. You state ν, and φ unless ideal; φ is per entity, never ν·φ; refuses a component off the stated basis; a mass concentration needs its molar mass.
Field: Formulation and stability.
What it does
You give
basis(required): molarity: concentrations per litre of solution (amount or mass concentrations), giving osmolarity; molality: per kilogram of water, giving osmolality. Required, never inferred; the two are never converted (that needs the solution's density).coefficients(required): ideal: φ = 1 for every component, set by this choice and echoed in the reply; stated: every component carries its own osmoticCoefficient. Required, never assumed.outputUnit(required): The unit of the result: osmol or mosmol, per litre on the molarity basis or per kilogram of water on the molality basis. osmol: one mole of independent osmotically active entities, weighted by the stated osmotic coefficients. The IUPAC Green Book (§2.11, note 24) discourages the name; it is used here as the field uses it.components(required): The solution's solutes, one entry each, at least one and at most fifty. Every concentration is on the stated basis.
No request is recorded for this tool.
Limits
- Research arithmetic for formulation and stability on values you supply, including every coefficient and constant; not a compounding, dosing, clinical, release, expiry-dating or regulatory authority.
- Formulation arithmetic on values you supply, including every dissociation number, osmotic coefficient, sodium chloride equivalent and freezing-point depression.
- A calculated osmolarity is not a measured osmolality, and a calculated isotonic amount is not a tonicity test.
- Research and education software: not for diagnosis or treatment decisions, and not a compounding or release authority.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
It will not answer when
- a component's concentration is not on the stated basis (a molality on the molarity basis, or a molarity or mass concentration on the molality basis): converting needs the solution's density, which this method does not take.
- components[*].osmoticCoefficient outside above 0.
Every input, with its units4 inputs
basis(required): molarity: concentrations per litre of solution (amount or mass concentrations), giving osmolarity; molality: per kilogram of water, giving osmolality. Required, never inferred; the two are never converted (that needs the solution's density).coefficients(required): ideal: φ = 1 for every component, set by this choice and echoed in the reply; stated: every component carries its own osmoticCoefficient. Required, never assumed.outputUnit(required): The unit of the result: osmol or mosmol, per litre on the molarity basis or per kilogram of water on the molality basis. osmol: one mole of independent osmotically active entities, weighted by the stated osmotic coefficients. The IUPAC Green Book (§2.11, note 24) discourages the name; it is used here as the field uses it.components(required): The solution's solutes, one entry each, at least one and at most fifty. Every concentration is on the stated basis.
Every refusal, with its code2 refusals
| Code | When |
|---|---|
BASIS_MISMATCH | a component's concentration is not on the stated basis (a molality on the molarity basis, or a molarity or mass concentration on the molality basis): converting needs the solution's density, which this method does not take. |
NOT_POSITIVE | components[*].osmoticCoefficient outside above 0. |
The calculation
The method's equations, constants and worked example.
Equation 1
osmolality = Σᵢ νᵢ·φᵢ·mᵢ
| Symbol | Meaning |
|---|---|
osmolality | osmolality of the solution, per kilogram of water; returned in osmol/kg, or in mosmol/kg (1 osmol = 1000 mosmol) when outputUnit is mosmol, osmol/kg |
νᵢ | independent entities per formula unit of component i (the argument particles) |
φᵢ | osmotic coefficient of component i (the caller's osmoticCoefficient; 1 with coefficients ideal) |
mᵢ | molality of component i, mol/kg |
νᵢ·φᵢ·mᵢ | contribution of component i, returned per component as contributions, in the result's unit, osmol/kg |
Source 1.
Equation 2
osmolarity = Σᵢ νᵢ·φᵢ·cᵢ
| Symbol | Meaning |
|---|---|
osmolarity | osmolarity of the solution, per litre of solution; returned in osmol/L, or in mosmol/L (1 osmol = 1000 mosmol) when outputUnit is mosmol, osmol/L |
νᵢ | independent entities per formula unit of component i (the argument particles) |
φᵢ | osmotic coefficient of component i (the caller's osmoticCoefficient; 1 with coefficients ideal) |
cᵢ | amount concentration of component i (from the mass equation where a mass concentration is given), M |
νᵢ·φᵢ·cᵢ | contribution of component i, returned per component as contributions, in the result's unit, osmol/L |
Source 1.
Equation 3
| Symbol | Meaning |
|---|---|
cᵢ | amount concentration of component i, M |
ρᵢ | mass concentration of component i (g/L divided by g/mol gives mol/L), g/L |
Mᵢ | molar mass of the form whose mass the concentration states, g/mol |
Source 2.
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of form-osmolarity@1.0.1, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.
Inputs
- basis = molarity
- coefficients = stated
- outputUnit = mosmol
- components[0].concentration = 9 g/L
- components[0].particles = 2
- components[0].osmoticCoefficient = 0.93
- components[0].molarMass = 58.44 g/mol
Steps
- c = 0.15400411 M, from components[0].concentration, components[0].molarMass; by equation 3.
- osmolarity = 286.44764 mosmol/L, from components[0].particles, components[0].osmoticCoefficient, c; by equation 2; gives osmolarity, contributions[0].
The working, as the case writes it:
2 × 0.93 × 9/58.44 × 1000 = 286.447… mosmol/L
Answer
osmolarity = 286.44764 mosmol/L
contributions[0] = 286.44764 mosmol/L
Where these values came from: our own exact-arithmetic script and a hand-worked case; stored reference values, osmolarity() (exact rational).
At build the tool returned this answer within the tolerance the file states: Osmolarity, osmolality and contributions relative 1e-12; no expected value is near zero (every concentration, ν and φ is positive): the near-zero floor (absolute 1e-312 below 1e-300, unit 1) is nominal; statuses, codes and units exact; this case's near-zero floors restated in its own output units (nominal, as in the file).
Sources
IUPAC, Quantities, Units and Symbols in Physical Chemistry (the Green Book), 3rd edition, RSC Publishing 2007 (2012 printing, IUPAC's searchable PDF)
Used for: Calculated osmolarity or osmolality of a solution from its components' concentrations, dissociation numbers and osmotic coefficients. At: equation osmotic coefficient, molality basis, φ_m = (mu*_A − mu_A)/(RT·M_A·Σ_B m_B), mu the chemical potential (spelt out: a reply carries no micro sign), p. 59, section Drybench's form: the sum of the caller's νᵢφᵢ times each molality. Terms after §2.11, notes 23 and 24 (entities B are independent solute molecules, ions, etc.; 'osmoles' discouraged), which defines one φ_m for the solution on molality; p. 59, section Drybench's form: the sum of the caller's νᵢφᵢ times each amount concentration. Terms after §2.11, which defines one φ_m for the solution on molality; the concentration basis is not printed there.
Read in full, 10 November 2026NIST Special Publication 811, Guide for the Use of the International System of Units (SI), 2008 edition
Used for: Calculated osmolarity or osmolality of a solution from its components' concentrations, dissociation numbers and osmotic coefficients. At: section 8.6.5 note 1 (mass concentration of B, ρ_B = m_B/V) and 8.6.4 (M = m/n): c = γ/M; as the Green Book §2.10, its 2010 erratum list not read.
Read in full, 10 November 2026
How it is checked
- Level
Checked against a reference.
- Checked against
Our own exact-arithmetic script and a hand-worked case.
- Cases
No case set is linked to this version.
- Not checked
The osmotic coefficients themselves; non-ideal mixing between components; the density conversion between molarity and molality; measured osmolality (freezing-point or vapour-pressure osmometry). Calculated serum osmolality and the osmolal gap (a diagnostic formula) are out of this method.
Changes to its methods0 changes
No change is logged for these method versions.