Ch · Chemistry

How Do PubChem, InChI, and SMILES Handle Uniqueness?

Published By the 9to5Science editorial team

At a glance

  1. 1. Separate the concepts

    A molecular structure, its text representation, and a database record are different things.

  2. 2. Compare representations

    Different SMILES strings can describe the same structure; canonical SMILES depends on the software and settings.

  3. 3. Check InChI layers

    Standard InChI applies defined normalization rules, so some distinctions may be intentionally collapsed.

  4. 4. Scope database IDs

    A PubChem CID identifies a record within PubChem, not a universal identity across every database.

Advertisement

PubChem, InChI, and SMILES are often treated as competing ways to identify a molecule. They are related, but they answer different questions: a PubChem CID points to a database record, while InChI and SMILES encode structures as text. Whether two identifiers count as “the same” depends on what structural details you want to preserve and what normalization rules you apply.

Three different kinds of identifier

SMILES (Simplified Molecular-Input Line-Entry System) is a text notation for a molecular graph. A molecule can usually be written as more than one valid SMILES string, because you can begin the traversal at different atoms or traverse a ring in different directions. For example, CCO and OCC both describe ethanol.

A canonical SMILES algorithm chooses one string from the valid alternatives for a particular structure. “Canonical” does not mean that every software package in the world will produce the same string. Different toolkits, settings, and versions can use different canonicalization rules. Some SMILES also leave out details such as stereochemistry; an isomeric SMILES can encode stereochemical information where specified.

InChI (International Chemical Identifier) is a layered identifier generated using defined rules. The Standard InChI form begins InChI=1S/. Its layers can encode information such as molecular formula, connectivity, hydrogen placement, charge, isotopes, and stereochemistry. The standard rules make InChI useful for comparing structures across systems, but they also make deliberate normalization choices. Some structures that differ in a way the standard treats as equivalent can have the same Standard InChI.

An InChIKey is a fixed-length, hashed form derived from an InChI. It is useful for searching and matching, but it is not a reversible structure notation. As with other hashes, collisions are theoretically possible, so an InChIKey match is not a mathematical proof that two unrestricted structures are identical.

A PubChem CID (Compound ID) identifies a compound record in PubChem. PubChem standardizes submitted structures according to its rules and associates the resulting records with CIDs. The CID is unique within PubChem’s database, but it is not a universal chemical identifier and does not by itself explain which distinctions PubChem’s standardization retained.

Worked example: ethanol

Ethanol illustrates why a text string and a structure are not the same thing. Two valid SMILES are:

CCO
OCC

Both strings describe the same connected graph: a two-carbon chain with an oxygen at the end. A canonicalization program may select one of these forms, but another program may select a different canonical string.

Ethanol’s Standard InChI is:

InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3

Its InChIKey is:

LFQSCWFLJHTTHZ-UHFFFAOYSA-N

PubChem lists ethanol as CID 702. These values serve different purposes: the SMILES strings are alternative notations, the InChI is a layered structure identifier, the InChIKey is a compact hash, and the CID points to PubChem’s ethanol record.

What does “unique” mean?

You need to specify both the comparison method and the chemical details that matter. For example, do you consider two records equivalent if they differ only in a counterion? Should different tautomers count as one substance or two? Must stereochemistry, isotopic labels, charge, and protonation state match?

There is no single answer for every task. A database may normalize some differences to group records, while a reaction database or a stereochemistry-sensitive study may need to keep them separate. A canonical string can provide a consistent spelling under one algorithm, but it cannot settle which chemical distinctions a project should treat as identity.

A practical comparison workflow

  1. Choose what must match. Decide whether stereochemistry, isotopes, charge, protonation, and tautomeric form are significant for your application.
  2. Parse the structures. Convert each input string into a molecular structure using the same software and settings. Do not compare raw noncanonical SMILES as if they were universal identifiers.
  3. Apply consistent normalization. If you want to ignore or standardize salts, charges, or tautomers, use a documented procedure and apply it to every structure.
  4. Compare the right output. Compare canonicalized structures from the same toolkit, or compare Standard InChIs when its normalization rules suit your purpose. Use a PubChem CID to retrieve a PubChem record, not as a cross-database structure key.
  5. Inspect ambiguous matches. For high-stakes or stereochemistry-sensitive work, inspect the structure and relevant layers rather than relying only on an InChIKey or a database ID.

Common mistakes

  • Assuming one molecule has one possible SMILES string. It can have many valid strings; canonicalization chooses a representative under a particular algorithm.
  • Treating “canonical” as a universal standard. Canonical SMILES is toolkit-dependent. Record the software and settings if reproducibility matters.
  • Assuming Standard InChI preserves every distinction. Its normalization rules can intentionally treat some variations as equivalent. Check whether those rules fit your use case.
  • Treating an InChIKey or CID as a complete chemical description. The key is hashed and the CID is database-specific. Neither is a replacement for checking the underlying structure when exact identity matters.

For routine lookup, a PubChem CID is convenient within PubChem. For exchanging structures between systems, Standard InChI is often useful. For drawing or entering structures, SMILES is compact and flexible. For deduplication, first define what “same chemical” means, then use a consistent structure-processing workflow.

References

  1. PubChem PUG REST Documentation
  2. InChI Technical FAQ

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.