Markdown chemical structure drawer
Draw a molecule from its SMILES string. Type the formula and get a clean chemical structure to embed in notes or teaching material.
The editor format
The editor writes one small text block, fenced as ```smiles. The first line is the keyword chemistry. Every line after that is one molecule: a SMILES string, then an optional label in double quotes. Lines starting with # are comments.
chemistry
c1ccccc1 "Benzene"
CC(=O)O "Acetic acid"
CCO "Ethanol"
| Line | Meaning |
|---|---|
chemistry | The first line — names the format |
c1ccccc1 | A molecule, drawn from its SMILES string |
CCO "Ethanol" | A molecule with a caption in double quotes |
# note | A comment, ignored when drawing |
A SMILES primer
SMILES writes a molecule as a short string of atoms. Letters are atoms, atoms next to each other are bonded, and hydrogens are filled in for you. Here is each piece you can write.
Atoms and bonds
Write element symbols in a row. Neighbouring atoms are joined by a single bond.
CCO
Double and triple bonds
Put = for a double bond or # for a triple bond between atoms.
CC(=O)O
Branches
Open a branch with a round bracket and close it to return to the main chain.
CC(C)CO
Rings
Match a pair of digits to close a ring, or use lowercase letters for an aromatic ring.
c1ccccc1
Cheat sheet
| Write this | You get |
|---|---|
C | A carbon atom, with hydrogens added for you |
O N S | Other atoms by element symbol |
CC | A single bond between neighbours |
= | A double bond |
# | A triple bond |
( ) | A branch off the main chain |
1 ... 1 | Matching digits close a ring |
c1ccccc1 | Lowercase letters make an aromatic ring |
Common molecules
Handy SMILES snippets to paste into the SMILES box.
| Molecule | SMILES |
|---|---|
| Water | O |
| Ethanol | CCO |
| Acetic acid | CC(=O)O |
| Benzene | c1ccccc1 |
| Phenol | Oc1ccccc1 |
| Aspirin | CC(=O)Oc1ccccc1C(=O)O |
| Caffeine | Cn1cnc2c1c(=O)n(C)c(=O)n2C |
| Glucose | OCC1OC(O)C(O)C(O)C1O |