---
title: MolScript
url: https://www.moldraw.com/docs/developers/molscript-language-for-reactions-and-mechanisms/
section: Embed and developer tools
updated: 2026-10-20
publisher: LabCanvas
---

# MolScript

> MolScript is a short text language for reaction schemes and curly arrow mechanisms. Open Templates in the left rail and pick the MolScript tab. Write species as SMILES and one move line per arrow, then click Draw on canvas. MolDraw draws the scheme and checks every arrow.

You write a few lines of text. MolDraw draws the structures, plus signs, reaction arrows, conditions, lone pairs, charges and curly arrows. The result is normal canvas content. You can edit it, export it or save it as [chemfig](https://www.moldraw.com/docs/import-export/how-to-export-chemfig-latex-and-paste-chemfig/). The AI chat also writes MolScript when you ask it for a mechanism.

For a long tutorial, read [MolScript: a text language for mechanisms](https://www.moldraw.com/blog/molscript-reaction-mechanism-language.html). For finished examples, see the [MolScript gallery](https://www.moldraw.com/blog/molscript-gallery.html).

## Draw your first script

1. Open the [editor](https://www.moldraw.com/) and click **Templates** in the left rail.
2. Click the **MolScript** tab.
3. Pick a script from **Example...**, or type your own.
4. Read the list under the editor. **No problems: the arrows give the products drawn** means it is ready.
5. Click **Draw on canvas**, or press `Ctrl+Enter`.

The scheme is placed beside your drawing as one undo step. On a phone, the editor opens as a bottom sheet.

## A complete example

This is the SN2 script from the examples list:

    title: SN2 of bromomethane
    [OH-:1] "hydroxide" + [CH3:2][Br:3] "bromomethane" ->[SN2][acetone] CO "methanol" + [Br-]
    move :1 -> 1..2
    move 2-3 -> 3

- `title:` puts a heading above the scheme.
- Species are SMILES. `:1`, `:2`, `:3` are atom map numbers on the atoms the arrows touch.
- `"hydroxide"` is a label drawn under the species.
- `->[SN2][acetone]` is a reaction arrow with text above and below it.
- `move :1 -> 1..2` is a curly arrow from the lone pair on atom 1 to a new bond between 1 and 2.
- `move 2-3 -> 3` moves the 2 to 3 bond onto atom 3.

## Scheme operators

| Write | Draws |
| --- | --- |
| `+` | Plus between co-reactants or co-products |
| `->` | Reaction arrow |
| `<->` | Resonance arrow |
| `<=>` | Equilibrium arrow |
| `=>` | Retrosynthesis arrow |

Put spaces around operators. A line that starts with an operator continues the scheme, so a multi-step mechanism reads one step per line.

## Curly arrow ends

| End | Meaning |
| --- | --- |
| `:n` | Lone pair on atom n |
| `n` | Atom n (a radical's arrow starts at its dot) |
| `n-m` | The existing bond between n and m |
| `n..m` | A bond being formed between n and m |
| `hn` | A hydrogen on atom n |

Use `->` in a move for a two-electron arrow and `~>` for a one-electron fish-hook. This example from the gallery splits bromine with light:

    [Br:1][Br:2] ->[hν] [Br] + [Br]
    move 1-2 ~> 1; 1-2 ~> 2

`push` writes a resonance chain once. `push :3 > 1 > 2` is the same as `move :3 -> 3-1; 1-2 -> 2`:

    C[C:1](=[O:2])[O-:3] <-> CC([O-])=O
    push :3 > 1 > 2

## Options and directives

- **Species options** go in braces after a species. Examples: `{ts}` for a transition state bracket, `{highlight=2/3-4:blue}`, `{ox=1:II}` for an oxidation state, `{flip}`.
- **Names:** `let enolate = [CH2-:1]C(C)=O "enolate"`, then use `$enolate`.
- **Abbreviations:** `[Ph]`, `[Me]`, `[tBu]`, `[Boc]`, `[R1]`, `[Ar]` and others.
- **Directives:** `title:`, `per-row:` (2 to 8, default 4) and `layout:` (`row`, `grid`, `cycle` or `branch`). Also `number: species`, `check:` (`warn`, `strict` or `off`) and `#` for a comment.

## Electron checking

MolDraw replays every arrow on the electrons. The structures it gets must match the products you wrote. Problems show under the editor with a line number, for example *C (map 2) has no lone pair*. Click a problem to jump to its line. It also reports an atom over its octet and an arrow from an atom with no electrons left. Stereocentres are followed too, so a missed SN2 inversion is reported. **Draw on canvas** stays off while there are errors.

## Editor help

- Words, options and map numbers are suggested as you type. Press `Tab` to take the first suggestion.
- **Language guide** opens the full tutorial.
- Bad lines are marked in the editor.

## More examples

The [gallery](https://www.moldraw.com/blog/molscript-gallery.html) shows the same mechanisms that are in the **Example...** list. For curly arrow drawing by hand, see [curved arrow mechanisms](https://www.moldraw.com/docs/reactions/how-to-draw-curved-arrow-mechanisms-and-fishhook-arrows/). For arrow pushing theory, read the [curly arrows guide](https://www.moldraw.com/blog/arrow-pushing-curly-arrows-guide.html).

## Questions and answers

**What is MolScript?**
MolScript is a text language for reaction schemes and curly arrow mechanisms. You write SMILES and move lines, and MolDraw draws and checks the scheme.

**Where is the MolScript editor in MolDraw?**
Click Templates in the left rail and open the MolScript tab.

**How do I draw a fish-hook arrow in MolScript?**
Use ~> instead of -> in a move line, for example move 1-2 ~> 1.

**Why does MolScript say an atom has no lone pair?**
The arrow starts at a lone pair the atom does not have after earlier arrows. Check the map number or start the arrow at a bond.

**Can I export a MolScript scheme to LaTeX?**
Yes. The drawn scheme is normal canvas content, so you can export it as chemfig code like any drawing.

## Practice it

- Interactive lesson: [How to draw curved arrow mechanisms](https://www.moldraw.com/learn/how-to-draw-curved-arrow-reaction-mechanisms/)

## Related pages

- [Curved arrow mechanisms](https://www.moldraw.com/docs/reactions/how-to-draw-curved-arrow-mechanisms-and-fishhook-arrows/)
- [Templates panel](https://www.moldraw.com/docs/library/how-to-use-mechanism-and-reaction-setup-templates/)
- [chemfig and LaTeX](https://www.moldraw.com/docs/import-export/how-to-export-chemfig-latex-and-paste-chemfig/)
- [Embed MolDraw and demos](https://www.moldraw.com/docs/developers/how-to-embed-moldraw-and-interactive-demos/)
