CDXML (.cdxml)

Background & Context

    • MIME type: chemical/x-cdxmlXML version of the ChemDraw Exchange format, CDX.
    • Represents an arbitrary number of chemical compounds.
    • XML format.
    • Stores atomic coordinates, chemical bond information and metadata.


  • Import["file.cdxml"] imports a CDXML file as a molecule.


  • General Export options:
  • IncludeHydrogensAutomaticspecifies whether hydrogen atoms are included in the exported file
  • With the default setting of Automatic, hydrogen atoms bonded to a carbon atom are not shown. Use option values True or False to include or hide all hydrogen atoms.


open allclose all

Basic Examples  (3)

Import a fluorene derivative from a CDXML file:

Show the molecule in a 2D structure diagram:

Import a model of a symmetric triglyceride from a CDXML file:

Show the molecule in a 2D structure diagram:

Export a molecule to a CDXML file:

Export Options  (1)

IncludeHydrogens  (1)

With the default setting of IncludeHydrogensAutomatic, hydrogen atoms attached to carbon atoms are treated as implicit and not exported to the file. For octanol, only the hydrogen attached directly to the oxygen atom is included explicitly:

To include all atoms in the output file, use IncludeHydrogensTrue:

Be aware that when all atoms are laid out, the structure may not look correct unless all hydrogens are shown when plotted:

Use the PlotTheme option for MoleculePlot to show all atoms: