SMILES notation: how to read and write SMILES strings

Atoms, bonds, rings and stereochemistry in one line of text

18 min

Caffeine as a molecular graph beside the same 14 atoms laid out in SMILES order, with the two ring-closure bonds highlighted.

TL;DR

  • SMILES (Simplified Molecular Input Line Entry System) is a line notation that writes a molecule as atoms and bonds in plain text. David Weininger published it in 1988.
  • Atoms are element symbols, = and # are double and triple bonds, parentheses are branches, matching digits close rings and lowercase letters mark aromatic atoms. Hydrogens are usually implied.
  • Square brackets hold anything unusual: charges such as [NH4+], isotopes such as [2H], explicit hydrogens and the stereo marks @ and @@. Slashes / and \ set double-bond geometry.
  • One molecule has many valid SMILES. A canonical SMILES is unique only within one program, so PubChem and ChEMBL write caffeine differently. Use InChIKey to match structures across databases.
  • Most parsing failures come from aromatic rings that cannot be kekulized, atoms with too many bonds and unclosed ring digits. Salts and missing stereochemistry pass silently and cause trouble later.

Look up caffeine in PubChem and you get CN1C=NC2=C1C(=O)N(C(=O)N2C)C. Look it up in ChEMBL and you get Cn1c(=O)c2c(ncn2C)n(C)c1=O. The two strings share almost no visible pattern, yet both describe the same 14 atoms joined the same way, and both are correct SMILES.[11][12] That is SMILES in one example: a notation compact and readable enough to type by hand, and loose enough that the same molecule can be spelled in hundreds of ways.

SMILES, short for Simplified Molecular Input Line Entry System, writes a molecule's atoms and bonds as a single line of text. Atoms are element symbols, bonds are punctuation, parentheses mark branches and digits close rings. Paste a SMILES into SMILES to PDB or SMILES to SDF and you get back a 3D structure, because the string holds everything needed to rebuild the molecule except its coordinates.

Who created SMILES

David Weininger published SMILES in 1988 in the Journal of Chemical Information and Computer Sciences, writing from the Medicinal Chemistry Project at Pomona College in California.[1] The work began at the US Environmental Protection Agency's Environmental Research Laboratory in Duluth, Minnesota, and was completed at Pomona. Weininger's point was efficiency: where a connection table might need 1,000 to 2,000 characters to describe morphine, SMILES stored the same information in 40.[1]

A second paper in 1989, with Arthur and Joseph Weininger, described an algorithm that writes one unique SMILES for each structure.[2] SMILES was then developed further as a proprietary specification by Daylight Chemical Information Systems, whose theory manual served as the reference for two decades.[3] Most chemistry toolkits and compound databases now read and write it.

What a SMILES string encodes

A SMILES describes a molecular graph. Atoms are the nodes, bonds are the edges, and each atom carries a few labels: element, charge, isotope, hydrogen count and, optionally, stereochemistry. It contains no coordinates, no bond lengths and no conformation, so a SMILES of a flexible drug says nothing about which shape it adopts in a binding pocket.

That makes SMILES the natural input for anything that works on chemistry rather than geometry: property calculators, fingerprints, similarity searches and machine learning models. To dock or simulate a molecule, the graph first has to be turned into 3D coordinates in a format such as SDF or PDB, which is what the conversion tools above do. Large biomolecular structures go the other way and are stored as coordinates in mmCIF or PDB files.

SMILES grammar with worked examples

The full grammar fits on a page. Aspirin, CC(=O)Oc1ccccc1C(=O)O, uses almost every basic rule, and its 21 characters describe 13 heavy atoms.

FragmentMeaningHydrogens implied
CMethyl carbon3
C(=O)Carbonyl carbon with a double-bonded oxygen as a branch0
OEster oxygen linking to the ring0
c1First aromatic carbon; opens ring bond 10
ccccFour aromatic CH carbons4
c1Sixth ring carbon; closes ring bond 1 back to the first0
C(=O)OCarboxylic acid on the ring carbon just written1
Table 1. Aspirin's SMILES read from left to right. Each fragment adds atoms to the chain; hydrogens are filled in afterwards. Sources: PubChem CID 2244, OpenSMILES (2016).[11][3]

Add the 8 implied hydrogens to 9 carbons and 4 oxygens and you get C9H8O4, aspirin's formula. The rules behind each step follow.

Atoms and brackets

Ten elements can be written as bare symbols: B, C, N, O, P, S, F, Cl, Br and I. OpenSMILES calls them the organic subset.[3] Every other element goes in square brackets, such as [Na], [Fe] or [Se]. Brackets are also required whenever an organic-subset atom needs anything unusual: a charge, an isotope, a stereo mark or a hydrogen count that differs from the default.

Inside brackets nothing is implied. [C] is a bare carbon atom with no hydrogens, [CH4] is methane, and [CH3] is a methyl radical. The order is fixed: isotope, element, chirality, hydrogen count, charge, as in [13CH3+].[3]

Implicit hydrogens

Outside brackets, hydrogens are added until the atom reaches its lowest normal valence. The normal valences are 3 for boron, 4 for carbon, 3 or 5 for nitrogen, 2 for oxygen, 3 or 5 for phosphorus, 2, 4 or 6 for sulfur and 1 for the halogens.[3] The parser sums the bond orders bib_i on the atom and fills the gap to the next valence vv at or above that sum:

nH=v−∑ibin_\text{H} = v - \sum_i b_i

If the sum is already above every normal valence, no hydrogens are added. So C is methane, N is ammonia, O is water and CCO is ethanol, with 3, 2 and 1 hydrogens on its three heavy atoms. Aromatic atoms are handled after the parser assigns alternating single and double bonds, so each c in benzene ends up with one hydrogen.

Bonds

Single bonds are implied between adjacent atoms, so CC is ethane. A double bond is = and a triple bond is #: C=C is ethene, C#C is acetylene, O=C=O is carbon dioxide and C#N is hydrogen cyanide. A hyphen - writes a single bond explicitly; OpenSMILES requires it only between two aromatic atoms joined by a non-aromatic bond, as in biphenyl, c1ccccc1-c1ccccc1.[3]

Branches

Parentheses hold a branch off the atom just before them, and the main chain resumes after the closing parenthesis. Ibuprofen in PubChem's form shows how this reads: CC(C)CC1=CC=C(C=C1)C(C)C(=O)O.[11]

CC(C)C is the isobutyl group, with the second carbon carrying a methyl branch. C1=CC=C(C=C1) is the benzene ring written with explicit double bonds, where the branch (C=C1) finishes the ring and the chain continues from the fourth ring carbon. C(C)C(=O)O is the propionic acid end, with a methyl branch on the carbon that later becomes ibuprofen's stereocenter. Branches can nest, and an atom can carry several, as in CC(C)(C)C for neopentane.

Ring closures

A ring is written as a chain whose two ends carry the same digit. C1CCCCC1 is cyclohexane: the first and last carbons are bonded because both are labelled 1. A digit can be reused once its ring is closed, so bicyclohexyl is valid as either C1CCCCC1C1CCCCC1 or C1CCCCC1C2CCCCC2. Above nine open rings at once, two-digit numbers take a percent sign, as in C%10.[3]

The digit is a bond, not an atom, so a bond symbol can sit in front of it. C1CCCCC=1 is cyclohexene, with the ring-closing bond made double. In fused rings, a second digit opens while the first ring is still open: in ChEMBL's caffeine, c2 starts the five-membered ring before ring 1 has closed, and n2 closes it.

Aromatic atoms

Lowercase symbols mark aromatic atoms: c, n, o, s, p and b, plus se and as in brackets. Benzene can be written in aromatic form as c1ccccc1 or in Kekulé form as C1=CC=CC=C1, and both describe the same molecule.[3] OpenSMILES accepts either on input and prefers the aromatic form on output, because it removes the arbitrary choice of where the double bonds go.

That preference explains the aspirin and caffeine mismatch above. PubChem writes Kekulé SMILES with uppercase atoms and explicit double bonds, while ChEMBL and RDKit write lowercase aromatic atoms. Note also that c in SMILES means an aromatic carbon, not a lowercase spelling of C: writing cyclohexane as c1ccccc1 gives you benzene.

Charges and isotopes

Charges go at the end of a bracket atom: [NH4+] is ammonium, [O-] an oxide or alkoxide oxygen, [Fe+2] ferrous iron. ++ and -- are still read as +2 and −2 but are deprecated in OpenSMILES.[3] A carboxylate, as in ibuprofen sodium, is written C(=O)[O-].

An isotope is a mass number in front of the element: [2H] is deuterium and [13C] is carbon-13. Deutetrabenazine, a version of tetrabenazine with deuterium on both methoxy groups, carries six [2H] atoms in its PubChem SMILES.[11] An atom written without an isotope is assumed to have the naturally occurring isotope ratios.[3]

Dots for disconnected parts

A dot separates pieces that are not bonded to each other. Sodium chloride is [Na+].[Cl-], and PubChem's ibuprofen sodium dihydrate is CC(C)CC1=CC=C(C=C1)C(C)C(=O)[O-].O.O.[Na+], four components in one string.[11][3] Salts, solvates and mixtures in databases are almost always written this way, which matters as soon as the string reaches a tool that expects one molecule.

Stereochemistry in SMILES

SMILES records two kinds of stereochemistry: the configuration of tetrahedral centers and the cis or trans geometry of double bonds. Both are optional, and leaving them out means unspecified, not a racemate or a mixture.[4]

Tetrahedral centers: @ and @@

A stereocenter is written in brackets with @ or @@. Look from the atom written before the center toward it; the remaining neighbors, in the order they appear in the string, run anticlockwise for @ and clockwise for @@.[3] A hydrogen written inside the bracket, as in [C@H], counts as the first of those remaining neighbors. Ring-closure digits on the stereocenter count in the order the digits appear.

Because the mark refers to writing order, it is not the same as R or S, and the same molecule can carry either mark. PubChem writes L-alanine as C[C@@H](C(=O)O)N and ChEMBL as C[C@H](N)C(=O)O.[11][12] Both are (S)-alanine: ChEMBL lists the amino group before the carboxyl group, and swapping two neighbors in the string flips @@ to @.

Double bonds: / and \

Double-bond geometry is set by the bonds on either side of it. / and \ read as bonds pointing up or down, so F/C=C/F is trans-1,2-difluoroethene and F/C=C\F is cis.[3] Fumaric acid, the trans isomer, is O=C(O)/C=C/C(=O)O, and maleic acid, the cis isomer, is O=C(O)/C=C\C(=O)O. Without the slashes, both collapse to the same string, O=C(O)C=CC(=O)O.

SMILES cannot express every kind of stereochemistry. OpenSMILES lists helices, conformational handedness and the folded shape of a protein as outside its scope.[3]

Why one molecule has many SMILES

You can start a SMILES from any atom, walk the branches in any order and break each ring at any bond. Aspirin can be written CC(=O)Oc1ccccc1C(=O)O, OC(=O)c1ccccc1OC(C)=O or c1ccc(c(c1)C(=O)O)OC(=O)C, and every one is valid. Even a molecule as small as aspirin has hundreds of valid SMILES, and the count grows quickly with size and branching.

A canonical SMILES fixes this by numbering the atoms with a deterministic algorithm and always writing them in that order. Weininger and colleagues published such an algorithm in 1989, and RDKit's current algorithm was published by Schneider, Sayle and Landrum in 2015.[2][6] Run MOL to SMILES on the same structure twice and you get the same string back every time.

The catch is that canonical means canonical for one program. Different toolkits use different algorithms and aromaticity models, and even one toolkit can change its output between versions. OpenSMILES says canonical SMILES "should not be considered a universal, global identifier".[3] In 2012 O'Boyle proposed Universal SMILES, which borrows InChI's atom numbering so that different toolkits can write the same string.[5]

DrugPubChem SMILESChEMBL canonical SMILESInChIKey
AspirinCC(=O)OC1=CC=CC=C1C(=O)OCC(=O)Oc1ccccc1C(=O)OBSYNRYMUTXBXSQ-UHFFFAOYSA-N
CaffeineCN1C=NC2=C1C(=O)N(C(=O)N2C)CCn1c(=O)c2c(ncn2C)n(C)c1=ORYYVLZVUVIJVGH-UHFFFAOYSA-N
IbuprofenCC(C)CC1=CC=C(C=C1)C(C)C(=O)OCC(C)Cc1ccc(C(C)C(=O)O)cc1HEFNNWSXXWATRW-UHFFFAOYSA-N
DexibuprofenCC@@HC(=O)OCC(C)Cc1ccc(C@HC(=O)O)cc1HEFNNWSXXWATRW-JTQLQIEISA-N
Table 2. The same drugs in PubChem and ChEMBL. PubChem writes Kekulé SMILES and ChEMBL writes aromatic SMILES with its own atom order. The InChIKey is identical in both databases for each drug. Sources: PubChem and ChEMBL, accessed October 30, 2026.[11][12]

Within one database, canonical SMILES works well for deduplicating records and exact lookups. Across databases, compare InChIKeys or re-canonicalize every string with the same toolkit before comparing.

Isomeric and non-isomeric SMILES

Daylight's terms separate two levels of detail. A generic SMILES describes only the labelled graph, while an isomeric SMILES also carries isotopes and stereochemistry; a canonical isomeric SMILES is sometimes called an absolute SMILES.[4]

PubChem shows both. Its SMILES field is isomeric, and its Connectivity SMILES field drops stereochemistry and isotopes.[11] For dexibuprofen, the (S)-enantiomer of ibuprofen, the Connectivity SMILES is identical to ibuprofen's. The InChIKeys in Table 2 show the same split: both share the first block, HEFNNWSXXWATRW, and differ only in the second, where the stereo layer is hashed.

OpenSMILES

Because SMILES began as Daylight's proprietary specification, toolkits filled the gaps in different ways. OpenSMILES is an open specification hosted by the Blue Obelisk project, written by Craig James with contributors including Noel O'Boyle, Greg Landrum, Geoff Hutchison and Egon Willighagen, developers of several open-source toolkits.[3] Version 1.0 is dated May 15, 2016.

OpenSMILES defines the grammar formally, writes down the implicit hydrogen and ring rules quoted above, and documents where parsers may disagree. Part of its section on aromaticity is still marked as under revision, which is one reason two toolkits can perceive the same ring differently.[3] Daylight's extensions for reactions and substructure queries, written as reaction SMILES and SMARTS, sit on top of the same syntax.

SMILES vs InChI, InChIKey and SELFIES

SMILES is one of several ways to write a structure as text. The others solve problems SMILES does not try to.

NotationCaffeineUnique per structureConverts back to a structureTypical use
SMILESCn1c(=O)c2c(ncn2C)n(C)c1=OOnly within one toolkit's canonical formYesInput, storage, cheminformatics, ML models
InChIInChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3Yes, by IUPAC standardYesExchanging and registering structures
InChIKeyRYYVLZVUVIJVGH-UHFFFAOYSA-NNearly; rare hash collisionsNoDatabase lookup and web search
SELFIES[C][N][C][=Branch1][C][=O][C][=C][Branch1][#Branch1][N][=C][N][Ring1][Branch1][C][N][Branch1][C][C][C][Ring1][N][=O]NoYesGenerative machine learning
Table 3. Common line notations for small molecules. Sources: Weininger (1988), Heller et al. (2013, 2015), Krenn et al. (2020).[1][7][8][9]

InChI and InChIKey

InChI, the IUPAC International Chemical Identifier, was introduced publicly in 2005 to give every defined structure one standard identifier.[7] Unlike SMILES, it applies a fixed normalization before writing anything and arranges the result in layers: formula, connectivity, hydrogens, charge, stereochemistry and isotopes.[8] Mobile hydrogens are listed as a group, so the tautomers 2-hydroxypyridine (Oc1ccccn1) and 2-pyridone (O=c1cccc[nH]1) get two different SMILES but one standard InChI.

The InChIKey is a 27-character hash of the InChI, built with SHA-256. Its first 14 letters encode the connectivity, the next block the stereo and isotope layers, and the last letter the protonation state.[8] It is short enough for search engines and database keys, but it cannot be turned back into a structure, and two different InChIs can occasionally share a key.[7] Use SMILES to InChI to generate both, and InChI to SMILES to go back.

InChI has its own trade-off: the normalization that makes it unique also means it is not the structure as drawn. Heller and colleagues point out that SMILES writes the structure as given, without accounting for tautomerism or resonance, which is why the same compound can end up with several SMILES across sources.[7]

SELFIES

Most random strings of SMILES characters are not molecules. Unclosed rings, unbalanced parentheses and atoms with too many bonds all fail to parse, which became a problem once neural networks started generating SMILES one character at a time. Krenn and colleagues introduced SELFIES (self-referencing embedded strings) in 2020 to remove it: every SELFIES string decodes to a valid molecule, and every molecule can be written in SELFIES.[9]

SELFIES uses bracketed tokens, and rings and branches are given as lengths rather than matched symbols. Ethanol is [C][C][O], and benzene is [C][=C][C][=C][C][=C][Ring1][=Branch1]. The arbitrary token string [F][=C][=C][#N] decodes to FC=C=N, because the decoder lowers bond orders that would break a valence; the equivalent SMILES F=C=C#N is simply invalid. The selfies Python library converts in both directions.[10]

For storing and exchanging structures, SMILES and InChI remain the standards. SELFIES matters mainly when a model has to write molecules.

Common SMILES errors

Most problems fall into two groups: strings that fail to parse, and strings that parse but describe something other than what you meant. The first group is loud, the second silent.

Kekulization and valence errors

The commonest parsing failure is an aromatic ring that cannot be given alternating single and double bonds. Pyrrole written as c1ccnc1 fails in RDKit with "Can't kekulize mol", because the five-membered ring needs the nitrogen to carry a hydrogen and donate its lone pair. The correct form is c1cc[nH]c1. The same error appears for imidazoles, indoles and purines whenever an [nH] has been lost.

Valence errors are the next most frequent. CC(C)(C)(C)C gives a carbon five bonds, and RDKit reports that the explicit valence is greater than permitted. A ring digit that is opened but never closed, as in C1CC, fails with an unclosed-ring error. All three are usually typos or truncated strings copied from a PDF or spreadsheet.

Salts, solvates and dot-disconnected parts

A string with a dot parses fine, but it describes more than one molecule. Ibuprofen sodium dihydrate carries a sodium ion and two waters; metformin hydrochloride is stored in PubChem as CN(C)C(=N)N=C(N)N.Cl.[11] Tools that build 3D structures take the string literally, so the counterion and waters come along, and descriptors such as molecular weight and logP are computed for the whole salt. Keep the largest organic component before docking or property filters such as Lipinski's rule of five.

Missing or wrong stereochemistry

A SMILES without stereo marks is not wrong, but it is incomplete. ChEMBL records ibuprofen as a racemic mixture, and its SMILES rightly leaves the center unspecified.[12] For a single-enantiomer drug copied from a source that dropped the marks, downstream tools have to guess, and a 3D builder will pick one configuration more or less arbitrarily. The stereoisomer generator enumerates every configuration of the unspecified centers so each can be docked or scored separately.

The other trap is reading @ and @@ as S and R. They describe neighbor order in the string, so editing a SMILES by hand, for example moving a substituent inside the brackets, can silently invert a center. Re-canonicalize after editing and check the assigned R or S labels.

Tautomers and protonation states

A SMILES fixes one tautomer and one protonation state, usually the neutral form drawn by whoever deposited it. A carboxylic acid written as C(=O)O is mostly deprotonated at pH 7.4, and an amine is mostly protonated, which changes hydrogen bonding in docking. Ligand protonation enumerates the likely ionization states for a pH range, and comparing standard InChIs is a quick way to see whether two SMILES are only tautomers of each other.

SMILES tools on ProteinIQ

To turn a SMILES into a 3D structure, SMILES to SDF keeps bond orders and charges for docking and cheminformatics, SMILES to PDB writes a file that opens beside proteins in PyMOL or ChimeraX, and SMILES to PDBQT prepares a ligand for AutoDock Vina. SMILES to MOL2 covers programs that expect Tripos files.

Going the other way, MOL to SMILES, SDF to SMILES and MOL2 to SMILES read a structure file and write its canonical isomeric SMILES. SMILES to InChI and InChI to SMILES move between the two notations.

Once a molecule is a SMILES, molecular descriptors calculates its formula, molecular weight, polar surface area and other properties, Lipinski's rule of 5 checks oral drug-likeness, and molecular similarity search ranks a library by fingerprint similarity to a query.

Frequently asked questions

What does SMILES stand for?

Simplified Molecular Input Line Entry System. Weininger chose a line notation so that chemists could type structures directly and computers could parse them in a single pass.[1]

Is SMILES case sensitive?

Yes. Uppercase element symbols are aliphatic atoms and lowercase ones are aromatic, so C1CCCCC1 is cyclohexane and c1ccccc1 is benzene. Two-letter elements keep their normal capitalization, such as Cl and Br, and CL is not chlorine.

How do I find the SMILES of a molecule?

Search the compound by name in PubChem or ChEMBL and copy the SMILES from its record, or draw it in a structure editor such as SketchIQ and export SMILES. Several ProteinIQ converters can also fetch a compound from PubChem by name or CID. Check whether you copied the isomeric SMILES if stereochemistry matters.

What is the difference between SMILES and SMARTS?

SMILES describes a specific molecule. SMARTS is a pattern language built on the same syntax for substructure searching, with additions such as atom lists and wildcards; Daylight's example [OH]c1ccccc1 matches any phenol.[13] Almost every SMILES is also a valid SMARTS, but not the other way around.

Can two different SMILES describe the same molecule?

Yes, and they usually do between databases. Convert both to canonical SMILES with the same toolkit, or compare their InChIKeys. If the InChIKeys match in the first block but not the second, the strings describe the same connectivity with different stereochemistry or isotopes.

Can SMILES represent proteins?

In principle yes, since a peptide is a molecular graph, but a protein of a few hundred residues becomes thousands of characters, and tools built for small molecules, including ProteinIQ's converters, reject inputs that large. Proteins are written as amino acid sequences in FASTA format and stored as coordinates in PDB or mmCIF files.