Open-source chemistry

Chemistry Calculators

Molar mass, equation balancing, pH, buffers, titrations, gas laws, half-life, electrochemistry and the periodic table — calculators backed by a verified open-source library written in Larzscript, running live in your browser.

Real Larzscript running in your browser847 automated checksOpen source · MITNo sign-up · your inputs never leave your device

Formulas and reactions

Molar mass, composition, empirical formulas, balancing equations and limiting reagents.

⚗️ Molar Mass CalculatorType any chemical formula — brackets and hydrates included — and get its molar mass, element-by-element breakdown, and moles and molecules for a sample.🧪 Percent Composition CalculatorFind the mass percent of every element in a compound, with a bar chart and the grams of each element in your sample.🧬 Empirical Formula CalculatorTurn percent composition or masses into the simplest whole-number formula, then into the molecular formula with a measured molar mass — with the working shown.⚖️ Chemical Equation BalancerBalance any chemical equation exactly, including redox reactions and hydrates.🧪 Limiting Reagent CalculatorFind the limiting reagent, theoretical yield, leftover reactants and percent yield for any balanced reaction with up to three reactants.

Solutions, acids and bases

pH, buffers, titration curves, molarity and dilution, solved exactly.

🧪 pH CalculatorCalculate the pH of strong and weak acids and bases from concentration and pKa, using the exact charge balance rather than shortcuts that fail in dilute solutions.🧪 Buffer pH Calculator (Henderson–Hasselbalch)Calculate the pH of a buffer, see how it responds when strong acid or base is added, and find its capacity and effective range.📈 Titration Curve CalculatorPlot the pH curve of a strong or weak acid titrated with NaOH and read off the equivalence point, half-equivalence pH and pKa.🧪 Molarity CalculatorCalculate molarity from grams and volume, or the grams of any solute (with brackets and hydrates) needed to make a solution of a target molarity.💧 Dilution Calculator (C₁V₁ = C₂V₂)Solve C₁V₁ = C₂V₂ for any unknown: the stock volume to take, the final concentration or volume, and how much solvent to add.

Gases, rates and cells

The ideal gas law, radioactive decay, electrochemistry and colligative properties.

💨 Ideal Gas Law Calculator (PV = nRT)Solve PV = nRT for pressure, volume, moles or temperature in any units (atm, kPa, bar, mmHg, psi; L, mL, m³; K, °C, °F).☢️ Half-Life CalculatorCalculate how much of a radioactive isotope or first-order reactant remains after any time, or how long until it reaches a target — with carbon-14 dating presets.🔋 Nernst Equation CalculatorCalculate cell potential at any concentration with the Nernst equation, plus ΔG and the equilibrium constant.❄️ Freezing Point Depression CalculatorCalculate freezing-point depression and boiling-point elevation for any solute (formula in, molar mass computed) in water, benzene, ethanol or acetic acid.

Atoms and the periodic table

All 118 elements and their electron configurations.

🧪 Periodic Table of the ElementsInteractive periodic table of all 118 elements with atomic weights, electron configurations, electronegativity, melting and boiling points, density and oxidation states.⚛️ Electron Configuration CalculatorGet the electron configuration of any of the 118 elements — full, noble-gas shorthand, orbital diagram, unpaired and valence electrons, and whether it breaks the Madelung rule.

Why you can trust the numbers

847automated checks
16calculators
118elements
0dependencies — pure Larzscript

Chemistry code fails quietly: a dropped subscript or a swapped ratio still prints a plausible number. So every result is compared with something that does not share its code — a second formula parser, an exact fraction-based equation solver, the exact cubic for pH solved in 60 digits, PubChem's atomic weights — and the tests are themselves tested by breaking the library on purpose. The method, and what it found, is written up in docs/VERIFICATION.md.

Use the library yourself

A complete program — it prints the balanced equation and the molar mass — using the same packages these pages run:

import "balancer" as b
import "chemistry" as ch

print(b.balance("C3H8 + O2 -> CO2 + H2O")["equation"])   # C3H8 + 5 O2 -> 3 CO2 + 4 H2O
print(ch.molar_mass("CuSO4.5H2O"))                        # 249.677
print(ch.weak_acid(0.1, 0.000018)["ph"])                  # 2.8753  (0.1 M acetic acid)

Source code, documentation and tests on GitHub → · What is Larzscript? · Learn Larzscript

Frequently asked questions

What is larzscript-chem?

An open-source chemistry toolkit written entirely in the Larzscript programming language: a formula parser and molar-mass calculator, an exact equation balancer, acid–base and titration solvers, gas laws, kinetics, electrochemistry, colligative properties, the periodic table and electron configurations.

How do I know the answers are right?

The library has 847 automated checks. Formulas are compared with a second, independently written parser; equations with a separate exact-fraction solver; pH and titration curves with the exact cubic equation solved in 60-digit arithmetic; the 118 atomic weights with PubChem's independent table; and the tests themselves are checked by deliberately breaking the code in 47 ways.

Does it run on my device or on a server?

On your device. The Larzscript interpreter is compiled to WebAssembly and runs in a background thread of your browser; your inputs are never sent anywhere.

Is it suitable for homework and exams?

It is a good way to check your own working: every page shows the formula used and a worked example. Confirm with your instructor whether calculators are allowed and which atomic weights (for example 12.01 or 12.011 for carbon) your course expects — answers may differ in the last digit.

Can I use the library in my own programs?

Yes — it is MIT-licensed. Install a Larzscript release (a single binary), clone the repository and import "chemistry" as ch. The repository documents every function.