Back to tools

SMILES to SVG

Generate publication-ready 2D molecular structures entirely in your browser.

COSMolKit 0.2.11 / Rust / WASM

Preview

14 atoms / 15 bonds
Download
2D molecular structure generated from SMILES
BROWSER-LOCAL DEPICTION

From SMILES to a scalable molecular drawing

COSMolKit parses the SMILES, generates 2D coordinates, and renders the molecular structure as SVG on this device. The resulting vector graphic can be copied or downloaded without uploading the molecule to a server.

PYTHON BACKEND

Build with the same COSMolKit core

The browser tool and Python package share the same Rust molecular graph, 2D coordinate generation, and SVG renderer.

COSMolKit Python 0.2.11
INSTALLpip install cosmolkit==0.2.11

Python 3.9+ / Rust-native wheel

generate_svg.py
from pathlib import Path
from cosmolkit import Molecule

smiles = "Cn1c(=O)c2c(ncn2C)n(C)c1=O"
mol = Molecule.from_smiles(smiles).with_2d_coordinates()
svg = mol.to_svg(width=720, height=480)

Path("molecule.svg").write_text(svg, encoding="utf-8")