Skip to main content
v2026.11,986 entries · CC-BY 4.0

InChIKey

InChIKey is a 27-character hashed fingerprint of an InChI chemical identifier, used for fast web indexing and chemical database lookups.

Written and maintained by CASRAI Editorial Board

Published · Last updated

On this page

An InChIKey is the fixed-length, 27-character hashed form of an InChI (IUPAC International Chemical Identifier). It is built from capital letters and hyphens in the pattern AAAAAAAAAAAAAA-BBBBBBBBFV-P, and it exists so that a chemical structure can be searched, indexed and cross-referenced as one short token instead of a long, slash-delimited InChI string. Aspirin (acetylsalicylic acid) is BSYNRYMUTXBXSQ-UHFFFAOYSA-N.

This guide explains what each character of the key means, how the key is produced, what the published collision testing shows, and where the key helps (and where it does not) in laboratory records, compound registries and data-management practice.

What is an InChIKey?

The InChI Trust describes the InChIKey as a fixed-length (27 character) condensed digital representation of the InChI. InChI itself is a structure-based chemical identifier developed under IUPAC, and InChI and InChIKey are described by the Trust as open standards whose software and algorithms are open source. An InChI describes a substance in layers: atom and bond connectivity, tautomerism, isotopes, stereochemistry and electronic charge. That makes it precise but long, and the string contains characters such as slashes, commas and parentheses that are awkward in URLs, file names and search boxes.

The InChIKey solves that by hashing. It is a hashed form meant for search, not a human-readable description: you cannot read a formula or a bond pattern out of it. Its job is to act as a compact, deterministic stand-in for the InChI that a database, a search engine or a spreadsheet can match exactly. In identifier terms it is a persistent identifier-style key computed from the structure itself rather than assigned by a registry, which is the main contrast with a registry-assigned CAS Registry Number.

How is an InChIKey structured?

The key has two hash blocks, three flag characters and two hyphens, for 27 characters in all. The InChI Trust technical FAQ gives the layout below. The letters are uppercase English letters, and the only other symbols are the hyphens. Using only uppercase letters is deliberate: it lets search engines treat the whole key as a single token.

Part Length What it encodes
Block 1 14 characters A hash of the basic (Mobile-H) InChI layer, the molecular skeleton or connectivity
Block 2 8 characters A hash of the remaining layers except the protonation layer: stereochemistry and isotopic substitution, plus the exact tautomeric hydrogen positions in a Non-standard key
Flag 1 character S for a Standard InChIKey, N for a Non-standard one
Version 1 character A for InChI version 1 (B is reserved for version 2)
Protonation 1 character, after the second hyphen A code replacing the /p layer, which is not hashed

Older descriptions, including some popular summaries, give a 14-10-1 layout. The current InChI Trust description is 14 + 8 characters of hash followed by the flag, version and protonation characters, which also totals 27.

Reading the aspirin key

PubChem lists aspirin (compound CID 2244) with the InChI InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12) and the InChIKey BSYNRYMUTXBXSQ-UHFFFAOYSA-N. Reading that key by the layout above:

  1. BSYNRYMUTXBXSQ is block 1, the hash of the skeleton.
  2. UHFFFAOYSA is block 2 plus the flag and version letters: an eight-letter hash (UHFFFAOY), then S for Standard and A for InChI version 1. Aspirin has no stereocentres or isotopic labels, so its second block is the one a molecule with no extra layers gets.
  3. N is the protonation character, which the InChI Trust table maps to zero added or removed protons: the neutral compound.

The protonation character

The last character stands in for the /p layer. N means 0 protons, M means −1, O means +1, L means −2 and P means +2, continuing through the alphabet in pairs up to Z for +12 and B for −12. A means fewer than −12 or more than +12 protons. Because the protonation layer is not hashed, two protonation states of the same compound normally differ only in this final character.

How is an InChIKey generated?

The key is derived from the InChI string, so you cannot compute it from a drawing directly: first a structure is converted to an InChI, then the InChI is hashed. IUPAC and the InChI Trust release open-source software that produces the InChI and the InChIKey from a structure.

  1. Start from a structure held in a chemical file or drawn in a sketcher (see the PubChem sketcher guide).
  2. Generate the InChI. For general exchange use the Standard InChI, whose parameters are fixed so that different databases produce comparable output. Standard InChI and InChIKey were released in January 2009.
  3. Hash the InChI. The hash is the cryptographic SHA-2 256-bit function, expressed in base-26 with uppercase letters. The design keeps 65 bits for block 1 and 37 bits for block 2 of the 256-bit result, according to the 2012 collision-resistance paper in the Journal of Cheminformatics.
  4. Assemble the key from the two hash blocks, the flag, the version character and the protonation character.

Hashing is inexpensive, which is why the key is practical for large collections. The InChI software also offers the options /XHash1 and /XHash2 (-XHash1 and -XHash2 on Linux), which output the remaining SHA-2 digits as hexadecimal tails for blocks 1 and 2 for users who want a longer hash.

Standard and Non-standard InChIKeys

A Standard InChIKey is computed only from a Standard InChI and carries the flag S. A Non-standard InChIKey carries N. The two must not be mixed in one comparison: a key with N as its flag can encode details, such as tautomeric hydrogen positions, that a Standard key deliberately leaves out. For interoperability between databases, the flag is the first thing to check.

The first block hashes only the Mobile-H skeleton, so tautomers of one compound share block 1. Block 2 is what separates stereoisomers and isotopic variants. In practice this gives a useful search technique: searching on the first 14 characters finds records for the same skeleton regardless of stereochemistry, while the full key narrows to one specific stereoisomer or labelled form.

Are InChIKeys unique? Collision resistance

A hash cannot be a unique identifier in the strict sense. The InChI Trust states this plainly: a hash function does not provide a unique identifier in the true sense, and the key may not fully replace an InChI string but is a convenient synonym and index to it. Collisions, where two different structures yield the same block, are possible and become unavoidable in very large or virtual collections. The question is how likely they are.

The InChI Trust technical FAQ gives these estimates and reports:

  • Block 1 has a theoretical 50% collision point of about 6.1 × 10⁹ molecular skeletons.
  • Block 2 is estimated to accommodate about 3.7 × 10⁵ stereo, protonation and isotopic isomers per skeleton.
  • The whole key is estimated to cover about 2.2 × 10¹⁵ structures.
  • For a collection of one billion entries, the accidental-collision probability for a new structure is given as 2.7 × 10⁻⁹ % for block 1 and 2.0 × 10⁻²⁰ % for both blocks. The FAQ calls these ideal, upper estimates that may not hold exactly because of unknown properties of SHA-2.
  • Testing on about 77 million merged InChI strings from ZINC, PubChem, GDB and FP42 found no duplicates.
  • Collisions in block 2 were reported in 2009 for stereoisomers of Spongistatin I, a molecule with 24 tetrahedral stereocentres and 2 stereogenic double bonds. The FAQ says these were expected for so complex a molecule. A September 2011 report of a block 1 collision in a computer-generated dataset could not be assessed because details were unavailable.

An experimental follow-up by Pletnev, Erin, McNaught, Blinov, Tchekhovskoi and Heller, published in the Journal of Cheminformatics (volume 4, article 39, 2012), tested the second block directly on the full set of 67,108,864 Spongistatin I stereoisomers: at the full set the expected number of collisions was about 16,384 and the observed number was 16,565. Block 1 was tested indirectly using 4-letter sequences, with more than 3 × 10¹⁰ keys generated across all tests. The authors concluded that observed collision behaviour agrees well with theoretical expectations.

The practical reading for a laboratory or repository: in ordinary compound collections a full Standard InChIKey match is strong evidence of the same structure, but it is evidence, not proof. For anything where an identity error is costly, confirm a key match against the InChI string or the structure.

Is an InChIKey reversible?

No. The InChI cannot be recovered from the InChIKey; you need a lookup table or database that stores both. That is why databases index the key and keep the InChI beside it. The key is a pointer, and a record must still hold the full InChI or structure to be self-describing.

Where InChIKeys are used in research data practice

Because the key is deterministic, any group that computes a Standard InChIKey from the same structure gets the same string. That supports several routine tasks:

  • Linking records across databases. A shared key lets a compound entry in one resource be matched to the entry in another, the role an identifier crosswalk plays between identifier schemes. Large chemistry resources such as PubChem list InChI and InChIKey on compound records (see the PubChem guide).
  • Searching and indexing. A single uppercase-and-hyphen token can be indexed by a web or database search engine as one term.
  • De-duplicating compound lists. Exact key matches flag probable duplicates in screening libraries, inventories and supplementary data tables.
  • Reproducible data sharing. Publishing the key with each compound in a data set or supplement lets others find the same substance without parsing a drawing. It complements, and does not replace, a name, a formula and a registry number.

For choosing between identifiers when documenting a compound, see the chemical database guide as a starting point for where the key can be looked up.

Limits and common mistakes

  • Treating it as an assigned ID. The key is computed, not registered, so it changes if the underlying InChI changes (for instance if the input structure is drawn with different stereochemistry).
  • Comparing Standard with Non-standard keys. Check the flag character.
  • Ignoring the protonation character. A salt or ionised form can share blocks 1 and 2 with the neutral form and differ only in the last letter.
  • Assuming the key is the structure. It identifies a structure by hash; it is not a lossless record of it.
  • Empty structures. An empty Standard InChI has a valid key (MOSFIJXAXDLOML-UHFFFAOYSA-N); an empty InChIKey itself is not valid.

Frequently asked questions

How long is an InChIKey?

Always 27 characters including the two hyphens: 14 for block 1, 8 for block 2, then the flag, version and protonation characters.

Is the InChIKey reversible?

No. It is a SHA-256-based hash, so the InChI or structure cannot be reconstructed from it. A database holding both is needed to go from key to structure.

Does the InChIKey change if the structure changes?

Yes. A different skeleton changes block 1, and a different stereochemistry or isotopic substitution changes block 2. A different protonation state changes only the last character.

What does the S in an InChIKey mean?

It is the flag for a Standard InChIKey, computed from a Standard InChI. An N in that position marks a Non-standard key.

What does the last letter of an InChIKey mean?

It encodes the protonation state that the unhashed /p layer would carry. N indicates zero protons added or removed, the neutral form.

Can two different molecules have the same InChIKey?

In principle yes, because any hash can collide. Published testing found no duplicates in about 77 million merged real-molecule InChI strings, and block 2 collisions were seen only for very complex stereoisomer sets.

Where can I find the InChIKey for a compound?

Public chemistry databases such as PubChem list it on the compound record, and the open-source InChI software can generate it from a structure.

Sources

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about InChIKey

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →