Chemistry Stack Exchange is a question and answer site for scientists, academics, teachers and students. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So far I've been unsuccessful in finding an open source tool that will convert a large number (>100k) of SMILES strings to a chemical structure. Is this really only solved by commercial applications? I would not mind converting through a number of intermediate formats. Ideally I'd do it with R, but that is the least of my worries. It's also neither for personal nor academic use.

share|improve this question
Welcome to Chemistry.SE! Take the tour to get familiar with this site. Mathematical expressions and equations can be formatted using $\LaTeX$ syntax. If you receive useful answers, consider accepting one. – Martin - マーチン Jan 5 at 9:19
I think my question would be what tools you found that you didn't think could convert SMILES to structures and how you were searching. Using "structure generation SMILES" on Google seems to work fine for me - obabel was the 6th result. – Geoff Hutchison Jan 5 at 16:04
up vote 11 down vote accepted

According to the website, Open Babel should do the trick: Documentation - SMILES, Sourceforge.

For example, the following code will give you a neat SVG file of the molecule benzene:

obabel -:"c1ccccc1" -O benzen.svg

If you experience problems using it, you are welcome to ask more specifically.

Alternatively, you can use a web-query from the national cancer institute. It is easily accessible by the following code"structure identifier"/"representation"

For example: benzene, "structure identifier"=c1ccccc1, "representation"=image.

Another open source solution, where you can directly export the structure into a molecular editor is Avogadro. (It uses Open Babel though.)

Depending on the actual problem, however, there might already be more advanced routines.

share|improve this answer
Thank you, that should do the trick for me! Suddenly I feel silly for asking. I'm at a loss how I missed that. – BootstrapBill Jan 5 at 15:21

In addition to the other good answers, I'd recommend rdkit, an open-source, freely available software for chemoinformatics. Most people use rdkit via its Python interface.

Here are some rdkit basics:

  1. The code base is available in GitHub, here.
  2. The license is quite permissive; you don't need to worry about what type of work (commercial, personal, or academic) you are doing.
  3. The Python API makes using rdkit easy, but all the core functions are written C++, making it fast and efficient. The Python API provides access to these functions in Python, making it flexible and easy to learn. If you happen to be fluent in C++, a C++ API is available.
  4. It does a whole lot more than convert SMILES to structures; see some examples here.

Here is one way to convert a SMILES to a structure in rdkit.

from rdkit import Chem
from rdkit.Chem import Draw

import matplotlib.pyplot as plt
%matplotlib inline

penicillin_g_smiles = 'CC1([C@@H](N2[C@H](S1)[C@@H](C2=O)NC(=O)Cc3ccccc3)C(=O)O)C'

penicillin_g = Chem.MolFromSmiles(penicillin_g_smiles)

Draw.MolToMPL(penicillin_g, size=(200, 200))

Here's a picture of the code and the resulting image. Penicillin G code

share|improve this answer

I'm surprised that you've had difficulty finding a toolkit - is it that the licence must be MIT or as permissive? I guess that you will be using this in software you are making, rather than a one-off data conversion?

For example, OpenBabel (C++), Chemistry Development Kit (Java), etc - in addition, the CDK can interface with R - would seem to suit your needs?

share|improve this answer
at the moment it is just for a one-off data conversion. at some point later it might be in the software, but then it would be okay to spend some money. also I'm suprise that you're surprised - may I ask what search terms you used? – BootstrapBill Jan 5 at 14:54
@BootstrapBill - Gilleain helps to develop the CDK. – Geoff Hutchison Jan 5 at 16:01
@BootstrapBill Hah! Geoff is right - probably it is easier for me to find them since I already know about them! :) That's the difficulty of answering questions, of course. I was really just checking that you hadn't already found and rejected the ones on the wikipedia list. – gilleain Jan 5 at 16:15
so thanks anyway. maybe i got confused :) – BootstrapBill Jan 6 at 8:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.