Search topics and sections

RDKit is a free, open-source software toolkit for cheminformatics, the use of computers to store, search, and study chemical structures. It was first built at the company Rational Discovery and released as open source in June 2006.[1][2]

RDKit reads molecules from text and files, checks that they make chemical sense, searches them for shared parts, measures how alike two molecules are, and builds 3D shapes. It also turns molecules into numbers that machine learning models can use.[3]

Code and license

The core is written in C++ and has a Python interface.[3][2]

RDKit uses a BSD license. This allows use in both open-source and closed-source products, meaning products whose source code is not public.[3][2]

What RDKit does

RDKit covers the everyday tasks of working with molecules on a computer. Its main features are:[3][4]

  • Reading and writing molecules in formats such as SMILES strings and MOL files (files that store a molecule's atoms and bonds).
  • Checking and cleaning up structures so they follow basic chemical rules.
  • Substructure search, which finds molecules that contain a given group of atoms.
  • Molecular fingerprints and similarity scores for comparing molecules.
  • Molecular descriptors, numbers computed from a structure, for building predictive models.
  • 2D drawings and 3D shapes of molecules.
  • Applying chemical reactions to sets of molecules.
  • A chemical extension for the PostgreSQL database and add-on nodes for the KNIME workflow tool.

Molecules as graphs

RDKit stores a molecule as a molecular graph. Atoms are the nodes of the graph and bonds are the lines that join them, and each atom and bond carries properties such as element, charge, and bond type.[4]

Hydrogen atoms are usually not stored as separate nodes. Instead each heavy atom (any atom other than hydrogen) records how many hydrogens it carries.[4]

A molecule can be built in several ways, such as from a SMILES string, a line of text that spells out atoms and bonds.[4][5]

In Python, Chem.MolFromSmiles('Cc1ccccc1') builds toluene. The lowercase c marks aromatic carbons (carbon atoms in an aromatic ring, where electrons are shared around the ring), and the digit 1 opens and closes the ring.[4]

If the input cannot be read, the reading functions return None instead of a molecule.[4]

SMILES string to molecular graph in RDKit Cc1ccccc1 SMILES (toluene) MolFromSmiles C0 C1 C2 C3 C4 C5 C6 3 H 0 H 1 H 1 H 1 H 1 H 1 H single aromatic bonds atoms = nodes, bonds = edges; hydrogens stored as counts
RDKit's MolFromSmiles reads the SMILES string for toluene into a molecular graph. Its seven carbon atoms are nodes and its bonds are edges, with each atom's hydrogen count stored as a property.

Sanitization

By default, RDKit checks each molecule it reads for chemical sense, a process it calls sanitization.[2]

Its developers say this emphasis on chemical correctness sets it apart from most other toolkits.[2]

Sanitization can be turned off, and most steps can be switched on or off by themselves.[6]

The steps

Several steps deal with valence, the number and types of bonds an atom has. The main sanitization steps run in this order:[6]

  1. Clear any properties computed earlier.
  2. Rewrite a few unusual valence states in a standard form. For example, some files write the nitro group (a nitrogen atom bonded to two oxygen atoms) as a neutral nitrogen with a valence of 5 (two double bonds to oxygen); this becomes its charge-separated form.
  3. Compute each atom's valence (the total order of its bonds, counting bonds to hydrogens) and raise an error if it is higher than allowed.
  4. Convert aromatic rings to a Kekulé structure of alternating single and double bonds, and fail if that is not possible.
  5. Work out the number of unpaired (radical) electrons on each atom.
  6. Find the aromatic rings and mark their atoms and bonds as aromatic.
  7. Find the conjugated bonds (alternating single and double bonds that share electrons) and each atom's hybridization, meaning how its electron orbitals mix to set its bond angles.
  8. Remove chirality marks, which record an atom's handedness, from atoms that are not sp3 hybridized. An sp3 atom has four hybrid orbitals that point to the corners of a tetrahedron, though not all of them must form bonds; in ammonia, one holds a lone pair of electrons.[7]

The valence check uses a table of allowed values for each element. Some examples follow.[6]

Element Allowed valences
Carbon (C) 4
Nitrogen (N) 3
Oxygen (O) 2
Phosphorus (P) 3, 5
Sulfur (S) 2, 4, 6

Aromaticity and rings

RDKit decides aromaticity with rules rather than by matching a list of known aromatic systems. In its default model, a ring or fused ring system (a group of rings that share bonds) is aromatic if it follows the 4N+2 rule (Hückel's rule), meaning its count of shared ring electrons is 2, 6, 10, and so on. Each atom adds 0, 1, or 2 electrons depending on its type and surroundings.[6]

Users can choose other built-in models, such as a simple model that only considers five- and six-membered rings, or supply their own.[6]

The smallest set of smallest rings (SSSR), the smallest collection of rings needed to describe all of a molecule's rings, is not unique.[6]

For very symmetric molecules the SSSR can look wrong. For cubane, the true SSSR holds only 5 rings although the cube has 6 faces. RDKit therefore uses by default a slightly larger set that treats symmetric rings alike, and offers the true SSSR as a separate function.[6]

A substructure search asks whether one molecule contains a smaller pattern of atoms. RDKit writes such patterns in SMARTS, a query language based on SMILES that can express conditions and wildcards (symbols that can match more than one kind of atom or bond).[4]

For example, the pattern ccO (two aromatic carbons followed by an oxygen) matches phenol, c1ccccc1O.[4]

The match returns the atom numbers (0, 5, 6), which are the two ring carbons and the oxygen.[4]

Plain SMILES can also serve as a query.[4]

Maximum common substructure

RDKit can also find the largest part two molecules share. It offers two methods:[4]

  • FindMCS finds the largest single connected piece shared by two or more molecules.
  • RascalMCES compares two molecules by shared bonds and can return a result made of several pieces.

Fingerprints and similarity

A molecular fingerprint is a long string of bits (zeros and ones) that summarizes a molecule's structure. Each set bit records that some structural feature is present, so molecules can be compared by comparing their bits, which is very fast.[8]

Fingerprint types

RDKit includes several kinds of fingerprint.[9][10]

Fingerprint What each feature describes
Morgan (circular) The atoms within a set number of bonds of each atom
RDKit Paths of bonded atoms, by default 1 to 7 bonds long
Atom pairs Pairs of atoms and the distance between them
Topological torsions Runs of four bonded atoms
MACCS keys A fixed list of 166 public structural keys, written in SMARTS

Morgan fingerprints

Morgan fingerprints describe the neighborhood around each atom, out to a chosen radius in bonds.[9]

The Morgan algorithm is named after H. L. Morgan, who described it in 1965 at Chemical Abstracts Service as a way to give each structure a unique computer description.[11][9]

RDKit's Morgan fingerprints are its version of extended-connectivity fingerprints (ECFPs), which were designed for modeling how structure relates to biological activity.[9][12]

The general method works in three steps:[13]

  1. Give each heavy atom a starting number by hashing its properties, such as element and number of connections. Hashing turns data into a single large integer by a fixed rule.
  2. Repeatedly update each atom's number by combining it with the numbers of its neighbors. Each round covers a circle one bond wider.
  3. Drop repeated numbers that describe the same neighborhood.

The resulting numbers are usually then folded into a bit string of fixed length.[13] Folding maps each integer to one position in the shorter bit string, so different features can share a bit.[8][13]

Names for these fingerprints use two different conventions. The 4 in ECFP4 is the diameter of the neighborhoods, the greatest distance in bonds across a neighborhood, while RDKit takes a radius. So a Morgan fingerprint with radius 2 roughly matches ECFP4.[9]

RDKit can also replace the starting atom properties with chemical feature types, such as hydrogen-bond donor. This gives fingerprints similar to FCFPs, which are based on feature types rather than exact atom identities.[9]

Morgan fingerprint radii around one atom C O NH₂ CH₂ H₃C radius 0 radius 1 radius 2 radius 2 in RDKit ≈ ECFP4 (diameter 4) hash each neighborhood to a number, then fold bit string (fixed length)
A Morgan fingerprint of propanamide grows outward from the carbonyl carbon (a carbon double-bonded to an oxygen): radius 0 covers that atom, radius 1 adds its three neighbors, and radius 2 adds the methyl carbon. Each neighborhood is hashed (turned into one large integer by a fixed rule) and folded (mapped to one position) into a fixed-length bit string; radius 2 in RDKit corresponds roughly to ECFP4.

Measuring similarity

The usual way to score how alike two fingerprints are is the Tanimoto coefficient, the share of set bits that the two have in common:[8]

T=ca+b+cT = \frac{c}{a + b + c}

Here aa is the number of bits set only in molecule A, bb the number set only in molecule B, and cc the number set in both.[8]

TT runs from 0 (no bits shared) to 1 (identical bits).[8] It is the default for RDKit's FingerprintSimilarity function.[9]

Tanimoto coefficient of two 12-bit fingerprints 01234567891011 110100101000 100110100010 A B c = 3 (set in both) a = 2 (only in A) b = 2 (only in B) T = c / (a + b + c) = 3 / (2 + 2 + 3) = 3/7 ≈ 0.43
Two 12-bit fingerprints A and B. The Tanimoto coefficient counts bits set in both (c=3c = 3), bits set only in A (a=2a = 2), and bits set only in B (b=2b = 2), so T=ca+b+c=37≈0.43T = \frac{c}{a + b + c} = \frac{3}{7} \approx 0.43. Positions where both bits are 0 are not counted.

RDKit also has other built-in measures, including:[9][8][14]

  • Dice, the bits in common divided by the average number of set bits in the two fingerprints.
  • Cosine, the bits in common divided by the geometric mean (the square root of the product) of the numbers of set bits in the two fingerprints.
  • Tversky, an uneven measure that weights the bits of one molecule more than the other.
  • Kulczynski, the mean of how much of each fingerprint the shared bits cover.
  • Sokal, like Tanimoto but counting the bits set in only one fingerprint twice, c/(2a+2b+c)c/(2a + 2b + c).
  • McConnaughey, twice the Kulczynski score minus 1, so it runs from −1-1 to 1.

A high score suggests the molecules share many substructures, which is the basis of chemical similarity searching.[8]

Bit fingerprints lose count information. RDKit can therefore also produce count fingerprints that record how often each feature occurs.[10]

Descriptors and machine learning

A molecular descriptor is a single number computed from a structure. RDKit provides many; two common ones are shown below.[4]

Descriptor What it measures RDKit function and method Value for benzoic acid, c1ccccc1C(=O)O
Topological polar surface area (TPSA) The surface area of a molecule's polar atoms, such as nitrogen and oxygen, estimated from its 2D structure Descriptors.TPSA, summing contributions of polar atoms 37.3
logP How much a compound prefers an oily solvent (octanol) over water Descriptors.MolLogP, the method of Wildman and Crippen about 1.38

Polar atoms such as nitrogen and oxygen pull shared electrons toward themselves and so carry a partial electric charge.[15]

RDKit documents where its descriptors differ from the original papers. Its TPSA, for example, counts only nitrogen and oxygen by default, following the original reference program; an option to include sulfur and phosphorus was added in the 2018.09 release.[16]

Use in machine learning

RDKit's fingerprints and descriptors feed predictive models in several ways.

  • QSAR. Fingerprints and descriptors are common inputs to quantitative structure-activity relationship (QSAR) models and other machine learning in chemistry.[3][12]
  • Original purpose. Predictive modeling was RDKit's first job. At Rational Discovery it was used to model toxicity, biological activity, and ADME (absorption, distribution, metabolism, and excretion), meaning how a substance enters the body, moves through it, is changed by it, and leaves it.[1]
  • Deep learning tools. The Chemprop package, for example, uses RDKit to turn SMILES strings into molecular graphs and offers Morgan and RDKit fingerprints as extra inputs.[17]

2D drawings and 3D shapes

RDKit can lay out atoms in 2D for drawing, with Compute2DCoords.[9]

It can also build 3D conformers, the shapes a molecule can take by rotating around its bonds.[9]

Hydrogens should generally be added before building 3D shapes, because they are important for realistic results.[4]

Distance geometry

RDKit's original 3D method uses distance geometry, which finds atom positions that fit a set of allowed distances. The steps are:[9]

  1. Compute a matrix of lower and upper bounds on each atom-to-atom distance from the bonds and a set of rules.
  2. Smooth the bounds with a triangle-bounds algorithm, so that no distance is longer than the sum of the other two in any triangle of atoms.
  3. Pick a random distance matrix that fits the bounds.
  4. Embed the distances in three dimensions, giving coordinates for each atom.
  5. Tidy the coordinates with a basic force field and the bounds matrix.

Shapes from plain distance geometry tend to be distorted, especially aromatic rings and sp2 centers (atoms with three bond directions in a flat arrangement, as in a carbon with a double bond). They are therefore usually cleaned up by force-field minimization: atom positions are adjusted to lower the molecule's energy as calculated by a force field.[18][9] RDKit includes the Universal Force Field (UFF) and the MMFF94 force field for this.[4]

ETKDG

ETKDG (experimental-torsion distance geometry with basic knowledge) adds data from real crystal structures.[18][19]

Sereina Riniker and Greg Landrum published the method in 2015.[18]

It works with torsion angles. A torsion angle is the twist around a bond, measured across four bonded atoms. ETKDG uses preferred torsion angles taken from small-molecule crystal data, described by an ordered set of SMARTS patterns.[18]

RDKit takes these preferences from the Cambridge Structural Database and applies them to correct the conformers after distance geometry, so a force-field cleanup step should not be needed.[4] ETKDG became the default method in the 2018.09 release.[4]

RDKit 3D conformer generation pipeline Molecule with hydrogens added 1. Bounds matrix from bonds and rules 2. Triangle-bounds smoothing 3. Random distance matrix within bounds 4. Embed in 3D (atom coordinates) 5. Tidy with crude force field and bounds ETKDG: correct with torsion-angle preferences from crystal structures (CSD) and basic knowledge Optional force-field minimization (UFF or MMFF94) often not needed with ETKDG Distance geometry Repeat from new random start for more conformers
RDKit builds 3D conformers by distance geometry in five steps, then ETKDG corrects torsion angles using preferences from crystal structures. Force-field minimization with UFF or MMFF94 is optional, and the process repeats from step 3 with a new random start to give more conformers.

A 2020 update, ETKDGv3, added torsion preferences for macrocycles (large rings) and optional ones for small aliphatic (non-aromatic) rings.[20][6][21] ETKDGv3 has been the default since the 2024.03 release.[4]

Running the method several times from different random starting points gives a set of conformers. These can then be aligned and compared.[4]

Chemical reactions

RDKit can apply a reaction to molecules, written in reaction SMARTS. A reaction SMARTS lists reactant patterns, then >>, then products, and numbers such as :1 map each reactant atom to its place in the product.[6]

For example, the reaction [C:1]=[O,N:2]>>[C:1][*:2] turns a carbon double-bonded to oxygen or nitrogen into a single bond. Applied to acetaldehyde, CC=O, it gives ethanol, CCO.[6]

Reactions can also be turned into fingerprints, so that two reactions can be compared by similarity.[21]

Architecture and languages

The core data structures and algorithms are written in standard C++ and make heavy use of the Boost libraries.[2]

Wrappers, thin layers of code that let another language call the C++ functions, make the core available in other languages.[3] Some are made with SWIG, a tool that generates the code that connects C and C++ programs to other programming languages.[22]

Language How it is connected
Python 3 Wrappers made with Boost.Python
Java Wrappers made with SWIG
C# Wrappers made with SWIG
JavaScript Wrappers for the most important functions
RDKit software architecture layersIntegrationsPostgreSQL cartridgeKNIME nodesPython 3(Boost.Python)Java(SWIG)C#(SWIG)JavaScript(key functions)C++ core: data structures and algorithms (uses Boost)PlatformsmacOS,Windows,Linux
RDKit is built in layers. A C++ core of data structures and algorithms, which uses Boost, sits under wrappers for Python 3, Java, C#, and JavaScript, with database and workflow integrations on top. It runs on macOS, Windows, and Linux.

RDKit runs on macOS, Windows, and Linux.[3]

Ready-built Python packages can be installed in two main ways:[23]

  • With pip, Python's package installer, which downloads them from PyPI, the Python Package Index.
  • With conda, from the conda-forge channel.

A Contrib directory in the standard distribution holds code contributed by community members.[3]

Example

This short Python example reads a molecule, computes two descriptors, searches for a pattern, and compares two molecules with Morgan fingerprints.[4][10]

from rdkit import Chem, DataStructs
from rdkit.Chem import Descriptors, rdFingerprintGenerator

m = Chem.MolFromSmiles('c1ccccc1C(=O)O')   # benzoic acid
print(Descriptors.TPSA(m))                 # 37.3
print(Descriptors.MolLogP(m))              # about 1.38

phenol = Chem.MolFromSmiles('c1ccccc1O')
patt = Chem.MolFromSmarts('ccO')
print(phenol.GetSubstructMatch(patt))      # (0, 5, 6)

gen = rdFingerprintGenerator.GetMorganGenerator(radius=2, fpSize=2048)
print(DataStructs.TanimotoSimilarity(gen.GetFingerprint(m),
                                     gen.GetFingerprint(phenol)))

Database cartridge and integrations

The RDKit cartridge adds chemical data types and operations to the PostgreSQL database.[2] It adds a mol column type, index support for fast searches, and chemistry operators for SQL, the language used to query databases.[24] An index is a lookup structure that lets the database find matching rows much faster than it could without one.[25]

The cartridge's chemistry operators include:[24]

  • @> tests whether a molecule contains a substructure.
  • % tests whether the Tanimoto similarity of two fingerprints is above a threshold, which is 0.5 by default.
  • # does the same with Dice similarity.
  • <%> returns nearest neighbors in order of Tanimoto similarity.

The documentation shows the cartridge loaded with ChEMBL 25, about 1.87 million molecules.[24]

Beyond PostgreSQL, RDKit works with these tools:[3]

  • KNIME, a workflow tool.
  • Django, a web framework.
  • SQLite, a database.
  • Lucene, a text-search engine.

History and development

RDKit grew out of in-house software at a company and became a community project.[1][2]

Year Event
2000 to 2006 Developed and used at Rational Discovery for predictive models
June 2006 Released as open source under a BSD license; Rational Discovery shuts down
After 2006 Development continues, with use and contributions from the Novartis Institutes for BioMedical Research
2018.09 release ETKDG becomes the default conformer method
2024.03 release ETKDGv3 becomes the default conformer method

The BSD license was a deliberate choice. When the project started, no open-source cheminformatics package allowed its authors to use it in closed-source software, and openness to commercial use remains a key principle.[2]

Releases and citation

  • Schedule. A major version comes out every six months, with bug-fix releases about once a month in between.[3]
  • Version names. Versions are named by year and month, such as 2026.03. The last number is 1 for the main release and goes up with each bug-fix release, as in 2026.03.2 through 2026.03.6.[26]
  • Source code. The code is developed on GitHub.[3]
  • Citation. There is no official RDKit paper. The project asks users to cite "RDKit: Open-source cheminformatics. https://www.rdkit.org" together with the DOI (digital object identifier, a unique lasting code for a publication or software release) of the version they used, which Zenodo assigns to each release.[3][2][27]

References

  1. The RDKit: History and Status, Gregory Landrum, RDKit User Group Meeting, 2012.
  2. RDKit_Paper: Text, Greg Landrum, GitHub.
  3. An overview of the RDKit, RDKit documentation, 2026.
  4. Getting Started with the RDKit in Python, RDKit documentation, 2026.
  5. Daylight Theory: SMILES, Daylight Chemical Information Systems.
  6. The RDKit Book, RDKit documentation, 2026.
  7. 1.10: Hybridization of Nitrogen, Oxygen, Phosphorus and Sulfur, Chemistry LibreTexts.
  8. Daylight Theory: Fingerprints, Daylight Chemical Information Systems.
  9. Getting Started with the RDKit in Python (2019.09), RDKit documentation, 2019.
  10. FingerprintGenerator tutorial, RDKit blog, 2023.
  11. The Generation of a Unique Machine Description for Chemical Structures: A Technique Developed at Chemical Abstracts Service, Journal of Chemical Documentation, 1965.
  12. Extended-connectivity fingerprints, Journal of Chemical Information and Modeling, 2010.
  13. Extended Connectivity Fingerprint (ECFP), Chemaxon documentation.
  14. rdkit.DataStructs.cDataStructs module, RDKit documentation, 2026.
  15. 2.1 Polar Covalent Bonds and Electronegativity, Organic Chemistry, OpenStax, 2023.
  16. RDKit Documentation (PDF), Read the Docs, 2019.
  17. Chemprop: A Machine Learning Package for Chemical Property Prediction, Journal of Chemical Information and Modeling, 2024.
  18. Better Informed Distance Geometry: Using What We Know To Improve Conformation Generation, Journal of Chemical Information and Modeling, 2015.
  19. Bayesian optimization for conformer generation, Journal of Cheminformatics, 2019.
  20. Improving Conformer Generation for Small Rings and Macrocycles Based on Distance Geometry and Experimental Torsional-Angle Preferences, Journal of Chemical Information and Modeling, 2020.
  21. RDKit Cookbook, RDKit documentation, 2026.
  22. Simplified Wrapper and Interface Generator, SWIG project.
  23. Installation, RDKit documentation, 2026.
  24. The RDKit database cartridge, RDKit documentation, 2026.
  25. Chapter 11. Indexes, PostgreSQL documentation.
  26. Releases, rdkit/rdkit, GitHub, 2026.
  27. What is a DOI?, DOI Foundation.

Figure