COSMolKit Tools

Loading browser workspace

Back to tools

SMILES to SVG

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

COSMolKit 0.2.12 / Rust / WASM

Preview

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

Convert 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

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.12
INSTALLpip install cosmolkit==0.2.12

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")

COSMolKit Tools

Loading browser workspace