# SMILES notation: how to read and write SMILES strings

> SMILES (Simplified Molecular Input Line Entry System) writes a molecule's atoms and bonds as one line of text, such as CC(=O)Oc1ccccc1C(=O)O for aspirin. Learn the grammar with worked drug examples, how @, @@, / and \ encode stereochemistry, why canonical SMILES differ between databases, and how SMILES compares with InChI and SELFIES.

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. 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](/app/smiles-to-pdb) or [SMILES to SDF](/app/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. 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.

A second paper in 1989, with Arthur and Joseph Weininger, described an algorithm that writes one unique SMILES for each structure. SMILES was then developed further as a proprietary specification by Daylight Chemical Information Systems, whose theory manual served as the reference for two decades. 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](/guides/sdf-file) or PDB, which is what the conversion tools above do. Large biomolecular structures go the other way and are stored as coordinates in [mmCIF](/guides/cif-file) 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.

  <caption><strong>Table 1. Aspirin's SMILES read from left to right.</strong> Each fragment adds atoms to the chain; hydrogens are filled in afterwards. Sources: PubChem CID 2244, OpenSMILES (2016).</caption>
  <thead>
    <tr>
      <th scope="col">Fragment</th>
      <th scope="col">Meaning</th>
      <th scope="col">Hydrogens implied</th>
    </tr>
  </thead>
  <tbody>
    <tr><td><code>C</code></td><td>Methyl carbon</td><td>3</td></tr>
    <tr><td><code>C(=O)</code></td><td>Carbonyl carbon with a double-bonded oxygen as a branch</td><td>0</td></tr>
    <tr><td><code>O</code></td><td>Ester oxygen linking to the ring</td><td>0</td></tr>
    <tr><td><code>c1</code></td><td>First aromatic carbon; opens ring bond 1</td><td>0</td></tr>
    <tr><td><code>cccc</code></td><td>Four aromatic CH carbons</td><td>4</td></tr>
    <tr><td><code>c1</code></td><td>Sixth ring carbon; closes ring bond 1 back to the first</td><td>0</td></tr>
    <tr><td><code>C(=O)O</code></td><td>Carboxylic acid on the ring carbon just written</td><td>1</td></tr>
  </tbody>

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. 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+]`.

### 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. The parser sums the bond orders $b_i$ on the atom and fills the gap to the next valence $v$ at or above that sum:

$$
n_\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`.

### 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`.

`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`.

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. 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. 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. An atom written without an isotope is assumed to have the naturally occurring isotope ratios.

### 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. 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.

### 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 `@@`. 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`. 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. 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.

## 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. Run [MOL to SMILES](/app/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". In 2012 O'Boyle proposed Universal SMILES, which borrows InChI's atom numbering so that different toolkits can write the same string.

  <caption><strong>Table 2. The same drugs in PubChem and ChEMBL.</strong> 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.</caption>
  <thead>
    <tr>
      <th scope="col">Drug</th>
      <th scope="col">PubChem SMILES</th>
      <th scope="col">ChEMBL canonical SMILES</th>
      <th scope="col">InChIKey</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>Aspirin</td><td><code>CC(=O)OC1=CC=CC=C1C(=O)O</code></td><td><code>CC(=O)Oc1ccccc1C(=O)O</code></td><td><code>BSYNRYMUTXBXSQ-UHFFFAOYSA-N</code></td></tr>
    <tr><td>Caffeine</td><td><code>CN1C=NC2=C1C(=O)N(C(=O)N2C)C</code></td><td><code>Cn1c(=O)c2c(ncn2C)n(C)c1=O</code></td><td><code>RYYVLZVUVIJVGH-UHFFFAOYSA-N</code></td></tr>
    <tr><td>Ibuprofen</td><td><code>CC(C)CC1=CC=C(C=C1)C(C)C(=O)O</code></td><td><code>CC(C)Cc1ccc(C(C)C(=O)O)cc1</code></td><td><code>HEFNNWSXXWATRW-UHFFFAOYSA-N</code></td></tr>
    <tr><td>Dexibuprofen</td><td><code>C[C@@H](C1=CC=C(C=C1)CC(C)C)C(=O)O</code></td><td><code>CC(C)Cc1ccc([C@H](C)C(=O)O)cc1</code></td><td><code>HEFNNWSXXWATRW-JTQLQIEISA-N</code></td></tr>
  </tbody>

Within one database, canonical SMILES works well for deduplicating records and exact lookups. Across databases, compare [InChIKeys](/guides/inchi-inchikey-smiles-cas) 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.

PubChem shows both. Its SMILES field is isomeric, and its Connectivity SMILES field drops stereochemistry and isotopes. 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. 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. 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.

  <caption><strong>Table 3. Common line notations for small molecules.</strong> Sources: Weininger (1988), Heller et al. (2013, 2015), Krenn et al. (2020).</caption>
  <thead>
    <tr>
      <th scope="col">Notation</th>
      <th scope="col">Caffeine</th>
      <th scope="col">Unique per structure</th>
      <th scope="col">Converts back to a structure</th>
      <th scope="col">Typical use</th>
    </tr>
  </thead>
  <tbody>
    <tr><td>SMILES</td><td><code>Cn1c(=O)c2c(ncn2C)n(C)c1=O</code></td><td>Only within one toolkit's canonical form</td><td>Yes</td><td>Input, storage, cheminformatics, ML models</td></tr>
    <tr><td>InChI</td><td><code>InChI=1S/C8H10N4O2/c1-10-4-9-6-5(10)7(13)12(3)8(14)11(6)2/h4H,1-3H3</code></td><td>Yes, by IUPAC standard</td><td>Yes</td><td>Exchanging and registering structures</td></tr>
    <tr><td>InChIKey</td><td><code>RYYVLZVUVIJVGH-UHFFFAOYSA-N</code></td><td>Nearly; rare hash collisions</td><td>No</td><td>Database lookup and web search</td></tr>
    <tr><td>SELFIES</td><td><code>[C][N][C][=Branch1][C][=O][C][=C][Branch1][#Branch1][N][=C][N][Ring1][Branch1][C][N][Branch1][C][C][C][Ring1][N][=O]</code></td><td>No</td><td>Yes</td><td>Generative machine learning</td></tr>
  </tbody>

### InChI and InChIKey

InChI, the IUPAC International Chemical Identifier, was introduced publicly in 2005 to give every defined structure one standard identifier. Unlike SMILES, it applies a fixed normalization before writing anything and arranges the result in layers: formula, connectivity, hydrogens, charge, stereochemistry and isotopes. 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. 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. Use [SMILES to InChI](/app/smiles-to-inchi) to generate both, and [InChI to SMILES](/app/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.

### 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.

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.

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`. 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](/guides/lipinski-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. 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](/app/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](/guides/predict-pka-online), and an amine is mostly protonated, which changes hydrogen bonding in docking. [Ligand protonation](/app/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](/app/smiles-to-sdf) keeps bond orders and charges for docking and cheminformatics, [SMILES to PDB](/app/smiles-to-pdb) writes a file that opens beside proteins in PyMOL or ChimeraX, and [SMILES to PDBQT](/app/smiles-to-pdbqt) prepares a ligand for AutoDock Vina. [SMILES to MOL2](/app/smiles-to-mol2) covers programs that expect Tripos files.

Going the other way, [MOL to SMILES](/app/mol-to-smiles), [SDF to SMILES](/app/sdf-to-smiles) and [MOL2 to SMILES](/app/mol2-to-smiles) read a structure file and write its canonical isomeric SMILES. [SMILES to InChI](/app/smiles-to-inchi) and [InChI to SMILES](/app/inchi-to-smiles) move between the two notations.

Once a molecule is a SMILES, [molecular descriptors](/app/molecular-descriptors) calculates its formula, molecular weight, polar surface area and other properties, [Lipinski's rule of 5](/app/lipinskis-rule-of-5) checks oral drug-likeness, and [molecular similarity search](/app/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.

### 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](/app/molecule-drawer) 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. 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](/guides/cif-file) files.
