SMILES format (smi, smiles)

A linear text format which can describe the connectivity and chirality of a molecule

Open Babel implements the OpenSMILES specification.

It also implements an extension to this specification for radicals.

Note that the l <atomno> option, used to specify a “last” atom, is intended for the generation of SMILES strings to which additional atoms will be concatenated. If the atom specified has an explicit H within a bracket (e.g. [nH] or [C@@H]) the output will have the H removed along with any associated stereo symbols.

See also

The Canonical SMILES format (can) produces a canonical representation of the molecule in SMILES format. This is the same as the c option below but may be more convenient to use.

Read Options


Preserve aromaticity present in the SMILES

This option should only be used if reading aromatic SMILES generated by the same version of Open Babel. Any other use will lead to undefined behavior. The advantage of this option is that it avoids aromaticity perception, thus speeding up reading SMILES.


Clean stereochemistry

By default, stereochemistry is accepted as given. If you wish to clean up stereochemistry (e.g. by removing tetrahedral stereochemistry where two of the substituents are identical) then specifying this option will reperceive stereocenters.

Write Options

-a Output atomclass like [C:2], if available
-c Output in canonical form
-U Universal SMILES
-I Inchified SMILES
-h Output explicit hydrogens as such
-i Do not include isotopic or chiral markings
-k Create Kekule SMILES instead of aromatic
-n No molecule name
-r Radicals lower case eg ethyl is Cc
-t Molecule name only
-x append X/Y coordinates in canonical-SMILES order
-C ‘anti-canonical’ random order (mostly for testing)
-o <ordering>

Output in user-specified order

Ordering should be specified like 4-2-1-3 for a 4-atom molecule. This gives canonical labels 1,2,3,4 to atoms 4,2,1,3 respectively, so that atom 4 will be visited first and the remaining atoms visited in a depth-first manner following the lowest canonical labels.


Store the SMILES atom order as a space-separated string

The string is stored as an OBPairData wth the name ‘SMILES Atom Order’.

-F <atom numbers>

Generate SMILES for a fragment

The atom numbers should be specified like “1 2 4 7”.

-R Do not reuse bond closure symbols
-f <atomno>

Specify the first atom

This atom will be used to begin the SMILES string.

-l <atomno>

Specify the last atom

The output will be rearranged so that any additional SMILES added to the end will be attached to this atom.

-T <max seconds>

Specify the canonicalization timeout

Canonicalization can take a while for symmetric molecules and a timeout is used. The default is 5 seconds.