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.
Formulas and reactions
Molar mass, composition, empirical formulas, balancing equations and limiting reagents.
Solutions, acids and bases
pH, buffers, titration curves, molarity and dilution, solved exactly.
Gases, rates and cells
The ideal gas law, radioactive decay, electrochemistry and colligative properties.
Atoms and the periodic table
All 118 elements and their electron configurations.
Why you can trust the numbers
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.