Skip to content

Syntax overview

AsciiChem is plain ASCII chemistry. Every construct is something a chemist can type on a standard keyboard. This page is the tour: every construct, one example each, links to the detail pages.

Source Rendered
H He C Fe Au
H He C Fe Au

Atom reference →

Source Rendered
H_2 H_2O H_2SO_4 C_6H_12O_6
H 2 H 2 O H 2 S O 4 C 6 H 12 O 6

Multi-character subscripts use braces: H_{2a}.

Source Rendered
^14C ^131I ^238U
C 14 I 131 U 238

The prefix binds to the following atom. Why this matters →

Source Rendered
Ca^2+ Cl^- SO_4^2- Fe^3+
Ca 2 + Cl - S O 4 2 - Fe 3 +

IUPAC canonical form: number-then-sign. +2 is normalised to 2+.

Source Rendered
Fe^(II) Fe^(III) Mn^(VII)
Fe II Fe III Mn VII

Roman numerals in parens.

Source Rendered
2H_2O 3H_2 10CO_2
2 H 2 O 3 H 2 10 C O 2

Leading digits followed by an element or open bracket.

Source Rendered
Ca(OH)_2 (NH_4)_2SO_4 [Fe(CN)_6]
Ca ( O H ) 2 ( N H 4 ) 2 S O 4 [ Fe ( C N ) 6 ]

Bracket variants (), [], {} are preserved through round-trip.

Source Rendered
H-O-H H_2C=CH_2 HC#CH Re##Re C>-H C-<H NH_3~>BF_3 A~~B
H - O - H H 2 C = C H 2 H C ≡ C H Re ≣ Re C ↑ H C ↓ H N H 3 → B F 3 A ∼ B

Eight kinds: single, double, triple, quadruple, wedge, hash, dative, wavy. Bond reference →

Source Rendered
(R)-CH_3 (S)-CH(OH)COOH (E)-CH=CH (Z)-A=B (alpha)-C (β)-C
(R)- C H 3 (S)- C H ( O H ) C O O H (E)- C H = C H (Z)- A = B (alpha)- C (beta)- C

Markers attach to molecules. Greek alpha/beta typed words are accepted alongside α/β. Stereo reference →

Source Rendered
:O ::O Cl. O=O..
: O :: O Cl . O = O ..

Prefix : for lone pairs; suffix . for radical electrons.

Source Rendered
2H_2 + O_2 -> 2H_2O HCl + NaOH -> NaCl + H_2O N_2 + 3H_2 <=>[Fe][400°C] 2NH_3
2 H 2 + O 2 → 2 H 2 O H Cl + Na O H → Na Cl + H 2 O N 2 + 3 H 2 ⇌ Fe 400°C 2 N H 3

Four arrow kinds: forward ->, reverse <-, equilibrium <=>, resonance <->. Conditions in [above][below] brackets. Reaction reference →

Source Rendered
A -> B -> C 2A -> 2B -> 2C A <=>[Fe][T] B -> C
A → B → C 2 A → 2 B → 2 C A ⇌ Fe T B → C

Multi-step chains promote to a single ReactionCascade. Cascade reference →

Source Rendered
1s^2 2s^2 1s^2 2s^2 2p^6 3s^2 3p^6 4s^2 3d^10
1s 2   2s 2   1s 2   2s 2   2p 6   3s 2   3p 6   4s 2   3d 10

Two or more orbital^occupancy pairs.

Source Rendered
`K_c = [P]/[R]` `x^2 + y^2` `rate = k[A]^2[B]`
K c = P R x 2 + y 2 r a t e = k [ A ] 2 [ B ]

Backtick-delimited runs are parsed by Plurimath. Embedded math reference →

Real chemistry mixes everything:

Source Rendered
^14C_6H_12O_6 + 6O_2 -> 6CO_2 + 6H_2O `Delta G = -2870 kJ/mol`
C 14 6 H 12 O 6 + 6 O 2 → 6 C O 2 + 6 H 2 O Δ G = − 2870 k J m o l

A radioactive glucose combustion with embedded thermodynamics.

Per-construct detail

Each syntax page has worked examples and round-trip behaviour. Start with Atoms.

The model

Every construct maps to a model class. See The model for the layer diagram and per-class reference.

IUPAC mapping

Every construct’s spelling traced to its IUPAC source. See IUPAC mapping.

Play