About AsciiChem
ASCII in, chemistry out.
AsciiChem is a plain-keyboard language for chemistry. Anything a chemist can type without leaving the home row, AsciiChem parses into a semantic model and renders to any supported output.
The logo: glucose, the molecule of life
Section titled “The logo: glucose, the molecule of life”The AsciiChem logo is a stylised glucose molecule — C₆H₁₂O₆ — the sugar that powers every cell in your body. Glucose is older than humanity, older than language, older than the oxygen in the air. It is the original currency of life.
What the ancients called the gift of the earth, we now know as photosynthesis: six molecules of carbon dioxide and six of water, rearranged by sunlight into one molecule of glucose and six of oxygen. The equation is the oldest covenant in biology:
6CO_2 + 6H_2O -> C_6H_12O_6 + 6O_2The Greek philosopher Empedocles (c. 494–434 BC) taught that all matter is composed of four roots — earth, water, air, and fire. Glucose embodies all four: carbon from the earth, hydrogen and oxygen from water, the air of CO₂, and the fire of sunlight that binds them. The three colours of the logo are the roots of the ancients, rendered in the language of modern chemistry.
Gray — carbon (the element of life)
Section titled “Gray — carbon (the element of life)”Every carbon atom in your body was forged in the heart of a dying star, ejected in a supernova, and swept into the cloud that became our solar system. You are, quite literally, stardust organised into sugar.
“We are made of star-stuff. We are a way for the universe to know itself.” — Carl Sagan
Blue — oxygen (the breath of the world)
Section titled “Blue — oxygen (the breath of the world)”Oxygen is what water becomes when it lets go of its hydrogens. It is the colour of the sky seen through a prism, the colour of the sea where life began. In the logo, blue marks the oxygen atoms that punctuate the glucose ring like waypoints on a journey from water to wine.
Gold — hydroxide, OH (the union of fire and water)
Section titled “Gold — hydroxide, OH (the union of fire and water)”The hydroxyl group is glucose’s handle on the world — it is how sugar dissolves, how it bonds, how it knows to be sweet. In the logo, the four gold trapezoids are the hydroxide groups that rim the glucose ring like petals on a flower.
“Honey is the golden thread that binds the flower to the stars.” — after Virgil, Georgics, Book IV
The Greek word γλυκύς (glykys) — “sweet” — gave us glucose, glycerin, and caramel. The same word that names the sugar in your blood named the honey that the ancients offered to their gods. Glucose is the oldest sweetness known to the human tongue.
Lucretius, in De Rerum Natura (c. 55 BC), wrote that “from a few elements, in so many ways, things are created and changed” — a vision of atoms and void that prefigured chemistry by two millennia. The logo captures this ancient insight: from three elements — carbon, hydrogen, oxygen — arranged in one particular way, comes the fuel that powers every thought you have ever had.
When you type C_6H_12O_6 in AsciiChem, you are writing the formula
that has kept life alive for four billion years.
Chem (chemistry). It follows the same naming pattern as
AsciiMath — a plain-keyboard language for a
domain that traditionally required typesetting.
The lowercase “A” in the logo wordmark nods to AsciiMath, the project that inspired this one. Where AsciiMath tackles mathematics typography, AsciiChem tackles chemistry semantics.
Origin
Section titled “Origin”AsciiChem was created to close the gap that AsciiMath leaves open:
chemistry is not math typography. Prefix isotopes (^14C), reactions
with conditions (N_2 + 3H_2 <=>[Fe][400C] 2NH_3), electron
configurations, and Lewis markers all have no clean AsciiMath
spelling.
The project is the language itself — a specification of syntax and semantics. The current reference implementation is the asciichem-ruby gem; other implementations (TypeScript, Python) may follow.
Mission
Section titled “Mission”AsciiChem’s mission is plain-keyboard chemistry: anything a chemist can type on a standard keyboard, AsciiChem should be able to parse into a semantic model and render to any supported output format.
Constraints that shape every design decision:
- Plain ASCII. No Unicode arrows, no LaTeX commands, no special characters that aren’t on a US keyboard.
- Model-driven. Every parse produces a typed tree. Render to any format without round-tripping through text.
- Round-trippable.
parse(s).to_text == sfor any canonicals. - IUPAC-aligned. Where AsciiChem’s spelling differs from
mhchem, the IUPAC Green Book is the tiebreaker. - Open/closed. New constructs are new model classes; new outputs are new formatters. Existing code stays untouched.
The ecosystem
Section titled “The ecosystem”| Project | Description |
|---|---|
| asciichem-ruby | Reference implementation (Ruby) |
| asciichem.github.io | This specification site |
| plurimath | Embedded math (AsciiChem wraps Plurimath for math expressions) |
Use cases
Section titled “Use cases”Publications
Type chemistry formulae in Markdown, AsciiDoc, or plain text and render consistently across HTML, PDF, and print.
Education
Students learn chemistry with a syntax they can type on any keyboard — no LaTeX, no special software required.
Tooling
Programmatic chemistry: parse, validate (via the linter), and render in build pipelines.
Migration
Convert existing mhchem content to a format that survives
outside LaTeX. The LaTeX formatter emits \ce{...} for
round-tripping.
Standards alignment
Section titled “Standards alignment”AsciiChem is designed against:
- IUPAC Green Book (3rd ed., 2007) — quantities, units, and symbols in physical chemistry.
- IUPAC Recommendation 2018 — inorganic chemistry formula nomenclature.
- LaTeX
mhchem— formula-level syntax (we borrow and adapt). - LaTeX
chemfig— structural-diagram concepts (deferred to v0.3+ via elk-rb integration). - CML (Chemical Markup Language) — XML round-trip is a target.
Where these sources disagree, the IUPAC Green Book wins. See IUPAC mapping for the full decision table.
Open source
Section titled “Open source”AsciiChem is open source under the BSD-2-Clause license.
- GitHub organisation: github.com/asciichem
- Contributing: PRs welcome — read Getting started for the development workflow.
- Issues: bug reports and feature requests on the respective GitHub issue trackers.
Get started
Section titled “Get started”- Install a reference implementation:
gem install asciichem - Read the syntax tour: Syntax overview
- Try the examples: Common formulae
- Join the community: star the repos and open issues.
Open source project maintained by Ribose.