COSMolKit Tools
Loading browser workspace
Back to tools
COSMolKit 0.2.12 / Rust / WASMSMILES to SVG
Generate publication-ready 2D molecular structures entirely in your browser.
Preview
14 atoms / 15 bondsConvert SMILES to an SVG molecular structure
COSMolKit parses the SMILES, generates 2D coordinates, and renders the molecular structure as SVG on this device. This browser-local SMILES visualizer and molecule drawing tool produces a vector graphic that can be copied or downloaded without uploading the structure to a server.
PYTHON BACKEND
COSMolKit Python 0.2.12Build with the same COSMolKit core
The browser tool and Python package share the same Rust molecular graph, 2D coordinate generation, and SVG renderer.
INSTALL
pip install cosmolkit==0.2.12Python 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")COSMolKit Tools
Loading browser workspace