Skip to content
AsciiC6hem

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 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.

Light mode
AsciiChem logo — glucose (light)
Dark mode
AsciiChem logo — glucose (dark)

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:

Source Rendered
6CO_2 + 6H_2O -> C_6H_12O_6 + 6O_2
6 C O 2 + 6 H 2 O C 6 H 12 O 6 + 6 O 2

The 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.

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

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.

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.

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:

  1. Plain ASCII. No Unicode arrows, no LaTeX commands, no special characters that aren’t on a US keyboard.
  2. Model-driven. Every parse produces a typed tree. Render to any format without round-tripping through text.
  3. Round-trippable. parse(s).to_text == s for any canonical s.
  4. IUPAC-aligned. Where AsciiChem’s spelling differs from mhchem, the IUPAC Green Book is the tiebreaker.
  5. Open/closed. New constructs are new model classes; new outputs are new formatters. Existing code stays untouched.
ProjectDescription
asciichem-rubyReference implementation (Ruby)
asciichem.github.ioThis specification site
plurimathEmbedded math (AsciiChem wraps Plurimath for math expressions)
📚

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.

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.

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.
  1. Install a reference implementation: gem install asciichem
  2. Read the syntax tour: Syntax overview
  3. Try the examples: Common formulae
  4. Join the community: star the repos and open issues.

Open source project maintained by Ribose.

Play