Skip to content

SMILES and Structure Descriptions

Type CC(=O)O and Molkit draws acetic acid; select a drawing and Molkit gives you its SMILES string back. Both directions use RDKit.js when it is loaded, which gives canonical, stereochemistry-aware results. Without it, a built-in parser handles the same commands with some limitations.

The commands are in the Structure menu: Import SMILES… opens the import dialog and Copy as SMILES copies the selection. Both are also in the command palette (Ctrl+K, search for “SMILES”). To import a structure file, see MOL and SDF Import.

Importing a SMILES string

To draw benzoic acid:

  1. Open Structure > Import SMILES….
  2. Type c1ccccc1C(=O)O into the input field.
  3. Press Enter or click Import. Press Escape to cancel.

The structure is placed at the center of your current view and left selected, so you can move it immediately. The whole import is a single undo step.

If the string cannot be parsed, the dialog stays open and the input turns red with an “Invalid SMILES string” message. Fix the string and try again.

Pasting a SMILES string directly onto the canvas (Ctrl+V) creates a text annotation. To get a structure, use Structure > Import SMILES….

RDKit.js and the fallback parser

Molkit loads RDKit.js from the unpkg CDN at startup, so it needs an internet connection the first time the page loads. If the library fails to load (offline use, blocked CDN), SMILES still works through a built-in fallback parser, with different results.

With RDKit, import gets a chemistry-aware 2D layout, kekulized aromatic rings, and correct wedge/dash placement for stereocenters. Export produces canonical SMILES.

With the fallback parser, import uses a simpler geometric layout (regular polygons for rings, roughly 120-degree chains). Aromatic input written in lowercase, such as c1ccccc1, comes in as a ring of single bonds drawn in the aromatic style, without alternating double bonds. Export walks the structure directly and is valid SMILES but not canonical, and it does not encode stereochemistry.

One special case runs the fallback even when RDKit is loaded: strings with explicit [H] atoms. RDKit drops those hydrogens during conversion, so Molkit detects the loss and reparses with the fallback to keep them.

Exporting to SMILES

Structure > Copy as SMILES works on the current selection only. Select the atoms you want (or press Ctrl+A to select everything), then run the command. The status bar shows “SMILES copied!” for a moment. With nothing selected, the command does nothing.

Only bonds whose both endpoints are selected are included, so a partial selection exports a fragment.

Stereochemistry

CaseWith RDKitFallback parser
Import, tetrahedral centers (@ / @@)Wedge and dash bonds placed correctlyOne bond on the stereocenter becomes a wedge or dash to flag it; the direction is a heuristic, not a CIP-correct assignment
Import, double bonds (/ and \)Cis/trans geometry recognizedCis/trans recognized; an E or Z label is attached to the double bond and the geometry is left as laid out
ExportStereochemistry encoded in the stringWedges and E/Z ignored

Multiple molecules

Dot-separated SMILES ([Na+].[Cl-]) imports as separate fragments, and exporting a selection that spans several disconnected molecules produces a dot-separated string. With the fallback parser, separate fragments may be laid out on top of each other after import; drag them apart with the select tool.

Copy a structure description

Structure > Copy Structure Description copies a short plain-text summary of the drawing, ready to paste into an email, a document or alt text. It describes the selected atoms, or the whole canvas when nothing is selected. After copying, Molkit shows “Structure description copied”.

For acetic acid drawn in skeletal form alone on the canvas, the text looks like this. Only drawn atoms are counted, so the implicit hydrogens appear in the formula but not in the atom count.

1 molecule, 4 atoms, 3 bonds
Molecular formula: C2H4O2
SMILES: CC(=O)O
IUPAC name: acetic acid

The lines are:

  1. Counts of molecules, atoms and bonds, prefixed “Selected:” when you copy a selection.
  2. “Molecular formula:” and “SMILES:”.
  3. “IUPAC name:”, the systematic name from PubChem. It is included only for a single molecule and only once Molkit has fetched the name in the background, which happens shortly after you stop editing. Copying does not wait for the lookup.

The formula and SMILES are left out, and a line explains why, when reaction arrows are on the canvas (whole-canvas copy only), when there are more than 10 separate fragments, or when RDKit.js is not loaded. An empty canvas gives “No molecular structure on the canvas.”

The same text is the canvas’s text alternative for screen readers: Molkit keeps it up to date in a hidden region next to the canvas as you draw.

For the stereo descriptors R, S, E and Z drawn on the canvas, see Stereo Labels.