Skip to content

Export an SVG

SVG is the format for figures that must stay sharp at any size. Atom labels stay selectable text, and the file matches the canvas. The file also carries the chemistry and, if you choose, an editable copy of the drawing, so that you can bring it back into Molkit later.

To export an SVG, click File > Export SVG, check the filename and options, and click Export SVG. SVG export has no keyboard shortcut.

The Export SVG dialog: filename, scope, dimensions with Size at 100% (actual size) and the printed size in points and millimeters, background, and the options (responsive, theme-aware, padding, mobile-safe rendering, editable source, labels to paths, maximum compatibility).
The Export SVG dialog.
  1. Select the molecule, for example by double-clicking any atom of acetic acid with the Select tool.
  2. Click File > Export SVG.
  3. Under Scope, select Selection Only.
  4. In Filename, type a name such as acetic acid. It appears as acetic-acid, and .svg is added.
  5. Click Export SVG.

Molkit stores the name you typed on the molecule, so the next export of the same selection starts with it. Exporting a selection that has no name yet saves it as a named selection under the name in Filename, which batch export can refresh later.

The Filename field is filled in from the first of these that exists:

  1. The named selection that matches your current selection.
  2. The saved name of the one whole molecule you have selected (empty if that molecule has no name yet).
  3. The last name used for this document, or the document’s filename (molecule for an untitled document).

Names are shown in web-safe form, so acetic acid becomes acetic-acid.

Option What it does Default
Scope All Content exports everything on the canvas. Selection Only exports the selected objects; it is unavailable when nothing is selected. All Content
Size 100% (actual size) to 1000%. The SVG stays vector; the size sets its width and height in points, at 0.75 pt per canvas pixel, so 100% matches the PDF and Word or Inkscape place it at its true size. Prints at: shows that size in points and millimeters. 100% (actual size)
Include background Adds a solid fill behind the drawing. Pick the color with the swatch or type a hex value. Clear it for a transparent SVG. On, white
Edit metadata A link that opens the metadata editor, so that you can set the title, description, and names first. See Document and molecule metadata.
Responsive (remove width/height) Drops the width and height attributes, so that the host page sizes the image. Size is unavailable and the size reads “Sized by container”. Off
Theme-aware (light/dark) Adds dark-mode colors that apply when the viewer is in dark mode. See Light and dark. Off
Padding Space in pixels around the content, 0 to 200. 20
Embed fonts for offline use Writes the font files into the SVG. Shown only when the document uses a Google font or a font you uploaded, and already selected when it uses an uploaded font. See Embed fonts or convert labels to paths. Varies
Mobile-safe rendering Embeds small stand-ins with the same letter widths for Arial, Helvetica, Times, and Courier. A note under the checkbox names them, and a warning triangle appears while the option is off and one of those fonts is in use. See Mobile-safe rendering. Your last choice
Include editable source Stores an editable copy of the document in the SVG. See Reopen an SVG in Molkit. Off, not remembered
Convert labels to paths Outlines atom labels as vector shapes, so they need no font, and they can no longer be selected. Only labels made of C, H, N, O, S, P, F, B, I, K, digits and the + and − signs are outlined; other labels and text boxes stay text. See Fonts in exports. Off
Maximum compatibility A static SVG for Microsoft Office (PowerPoint, Word), Keynote, LibreOffice, and print. Selecting it turns on Convert labels to paths and turns off Theme-aware (light/dark) and Embed fonts for offline use; you can change those three again afterward. Off
Omit per-atom implicit H counts (metadata) Records each atom’s implicit hydrogen count as 0 in the embedded data. The formula, molecular weight, and atom count still include implicit hydrogens. Unavailable when the export has no implicit hydrogens. Off
Electrostatic maps Where an electrostatic potential map goes: Inside the SVG (one file), Separate file (on demand), or Leave out. Shown only when a molecule in the document has a current map. Inside the SVG (one file)

Options that cannot affect the export are hidden. With no atoms in scope, Omit per-atom implicit H counts (metadata) is hidden. When the export holds only images, such as a captured 3D view on its own, the text, font, and theme options are hidden as well.

The dialog shows a preview built the same way as the export, so it matches the saved file. If the export fails, an error message gives the reason and the dialog stays open.

The Molkit editor has one light appearance and no light/dark switch. To recolor the drawing itself, change the color scheme. Light and dark matter once the file leaves Molkit: a website or slide viewer in dark mode shows your black bonds on a dark background.

Theme-aware (light/dark) fixes this. It writes a @media (prefers-color-scheme: dark) rule into the SVG, so that a viewer set to dark mode shows colors suited to a dark background and a viewer in light mode shows the light version, from the same file. A host page can also force either version with the mk-light or mk-dark class; see CSS theming.

The checkbox is in two dialogs:

  • Export SVG, off by default.
  • Export Animated SVG, on by default.

A LaTeX solution animation has no checkbox: it always takes its colors from the page it sits on (see Animate a LaTeX solution).

Leave the option off when the export must look the same everywhere. Maximum compatibility turns it off, because that option fixes the colors in the file for apps such as PowerPoint and Keynote.

With the option off, the export uses the colors that the app is showing.

The dialog starts from the options you chose last, in this document or any other, and after a reload. The filename is not carried between documents. Exports that contain a structure and exports that do not (a 3D capture on its own, for example) keep separate settings, so changing one leaves the other alone.

If you save the document after exporting, the .mkit file stores its own export settings, and they take priority for that document.

  • Vector geometry with a viewBox set to the content bounds, an inline style sheet, and atom labels as text unless you converted them to paths.
  • Chemistry data for every atom and bond, plus molecule-level data such as the formula, SMILES, and a MOL block. This data is always included and has no checkbox. See Embedded chemistry metadata.
  • A 3D geometry and net dipole for each molecule, when one can be generated. The Molkit Viewer uses these. If generation fails, the export goes ahead without them.
  • An editable copy of the drawing, only if you select Include editable source. See Reopen an SVG in Molkit.
  • An electrostatic potential map, when a molecule in the export has a current one. The Electrostatic maps option, shown when a molecule in the document has a current map, writes it Inside the SVG (one file), as a Separate file (on demand) with the .esp extension in the folder you name (esp by default), or leaves it out (Leave out). A separate map file downloads next to the SVG, and a message tells you which folder to put it in, beside the SVG. See Electrostatic potential maps.

When you are online and Edit > Look Up Names Online (PubChem) is selected, the export also looks up the molecule in PubChem to add its IUPAC name and identifiers. The lookup stops after 8 seconds, and the export completes either way.

If the structure uses R groups with defined substituents and their geometry could not be embedded, a warning tells you that the SVG has the substituent legend but no drawable fragments. Check the R group definitions and export again.

An SVG exported with Include editable source comes back into Molkit as editable objects:

  1. Export with Include editable source selected.
  2. Open the SVG with File > Import SVG, drop it on the canvas, or paste it.

Without the editable source, Molkit brings the SVG back as a picture.

The option is off each time the dialog opens and is not remembered, because anyone who receives the file also receives the full document. Turn it on for working copies that you plan to edit again, and leave it off for files that you share or publish.

A host web page can restyle the SVG with CSS, read the chemistry from JavaScript, and follow the site’s theme toggle. The developer guide has code examples.