Skip to content

Import MOL and SDF files

Most chemistry databases and drawing programs can save a structure as an MDL MOL file (.mol) or an SD file (.sdf). Molkit reads either one and turns it into an ordinary drawing: atoms and bonds that you can edit, restyle, and export like anything you drew yourself.

For example, to import caffeine that you downloaded from PubChem as caffeine.sdf:

  1. Select File > Import MOL/SDF….
  2. Select the file. The file dialog accepts .mol, .sdf, .sd, and .mdl files.

The structure appears at the center of your view and is selected, so you can drag it into place.

The whole import is one undo step: Ctrl+Z removes it.

If the canvas was empty, or the new structure would land outside the visible area, the view zooms to fit it. Otherwise the view does not change.

  • Drag and drop. Drop one or more .mol, .sdf, .sd, or .mdl files on the canvas. Each structure lands where you drop it; several files are staggered 20 px apart.
  • Paste. Copy the text of a MOL block (for example, from a text editor or a database page) and press Ctrl+V on the canvas. Molkit recognizes the block and imports a structure instead of creating a text box. The check is strict: the fourth line must be a counts line ending in V2000 or V3000, so ordinary text is never mistaken for a molecule. Images and SVG on the clipboard take priority over MOL text.
From the file In Molkit
2D coordinates Kept, then scaled so that the average bond matches the bond length of the document (see Structure settings). The y axis is flipped so that the drawing is not upside down.
3D coordinates Laid out again in 2D, so no two atoms land on the same spot.
Elements Kept. Carbons are drawn as bare vertices; other elements get labels.
Single, double, and triple bonds Kept.
Aromatic bonds (type 4) Drawn with alternating double bonds.
Wedge and hash stereo flags (1 and 6) Drawn as solid and hashed wedges. Other stereo flags are ignored.
Charges Read from the atom block and from M CHG lines; M CHG takes priority. A nitrogen written with five bonds, as in a nitro group N(=O)=O, comes in as N+ with one O−.
Hydrogens Explicit hydrogen atoms are kept as drawn. Implicit hydrogens follow each atom’s valence, including on silicon, so disilane comes in as H3Si–SiH3.
Radicals Read from M RAD lines and from the old charge code 4 in the atom block.
Isotopes Read from M ISO lines and from the mass difference in the atom block.

Lone pairs and other property lines are not read. To add lone pairs afterward, use the lone pair tool; to check the result, use validation.

Molkit reads V2000 files, the common format, and V3000 files with its chemistry library, which it loads from the internet when the page opens. Both formats get the same handling of hydrogens, charges, radicals, and 3D coordinates. If you are offline, a V2000 file is still read, but without the hydrogen, radical, and 3D handling in the table above, and a V3000 file is not read: Molkit shows a warning that begins “This is a V3000 MOL file. V3000 import needs the chemistry engine (RDKit)” and imports nothing. To import the structure, save the file as V2000 in the program that made it, or try again when you are online.

An SD file can hold many records separated by $$$$ lines. Molkit imports only the first record and shows “Imported the first of N structures in this SDF file.” To import a different record, open the file in a text editor, copy that record’s MOL block (from the header line down to M END), and paste it on the canvas.

Message Cause
“No molecule found in that MOL/SDF file.” The file is empty or has no records.
“Could not read any atoms from that MOL/SDF file.” The counts line or atom block could not be parsed: the file has fewer atom or bond lines than its counts line says, a coordinate is blank, or a bond names an atom that is not there.
“Could not read this V3000 MOL file (the chemistry engine could not parse it).” The V3000 data in the file is damaged or uses features that Molkit cannot read.
“Placed the imported structure beside the existing one to avoid overlap.” You imported the same file twice without moving the first copy, so Molkit placed the second copy diagonally beside the first.

For a structure written as text, use SMILES. For 3D coordinates from a computational chemistry program, use Import XYZ coordinates, which also works out the bonds.