# What is a CIF file? Small-molecule CIF and mmCIF explained

> A CIF file is a plain-text Crystallographic Information File. Learn the difference between small-molecule CIF and macromolecular mmCIF, how data blocks and loops work, why the PDB replaced the PDB format with mmCIF, and how to convert between them.

Look up the human 80S ribosome, PDB entry [4V6X](https://www.rcsb.org/structure/4V6X), and the RCSB download menu offers no PDB file. The model has 237,685 atoms in 89 chains, with chain names such as `Az` and `CR`, and none of that fits the fixed columns of the old format. What you get is `4v6x.cif`. Download a crystal structure of aspirin from the Crystallography Open Database and you also get a `.cif` file, yet it describes a unit cell and has no chains at all.

Both are Crystallographic Information Files. CIF is a plain-text format of named data items and tables, published in 1991 as the International Union of Crystallography (IUCr) standard for small-molecule crystallography. mmCIF applies the same syntax to proteins and nucleic acids, and as PDBx/mmCIF it has been the PDB archive's standard format since 2014. The [PDB viewer](/app/pdb-viewer) opens mmCIF in any browser, and [PDB to CIF](/app/pdb-to-cif) turns a legacy PDB file into one.

## Small-molecule CIF and mmCIF

The two kinds of file share a grammar, which descends from the STAR (Self-defining Text Archive and Retrieval) format, and differ in the dictionary that says what each data name means. Small-molecule CIF is the format crystallographers submit to IUCr journals and that the Cambridge Structural Database and the Crystallography Open Database distribute. These lines come from the room-temperature aspirin structure in COD entry 2104857:
```text
data_2104857
_chemical_formula_sum            'C9 H8 O4'
_chemical_name_common            aspirin
_symmetry_space_group_name_H-M   'P 1 21/c 1'
_cell_length_a                   12.2696(5)
_cell_length_b                   6.5575(3)
_cell_length_c                   11.4960(4)
...
loop_
_atom_site_type_symbol
_atom_site_label
_atom_site_fract_x
_atom_site_fract_y
_atom_site_fract_z
_atom_site_U_iso_or_equiv
...
C C1 0.15361(12) 0.5634(2) -0.00763(12) 0.0422(4) Uani d . 1 . .
C C2 0.24609(13) 0.4867(2) -0.11120(12) 0.0445(4) Uani d . 1 . .
```
Two habits of crystallographers show here. The number in parentheses is the standard uncertainty in the last digits, so `12.2696(5)` means $12.2696 \pm 0.0005$ Å. The atom positions are fractional coordinates, expressed as fractions of the cell edges rather than in ångströms. When all three cell angles are 90°, converting them is a simple scaling, $x = a\,x_f$, $y = b\,y_f$, $z = c\,z_f$; for a monoclinic cell like this one, the β angle enters through a conversion matrix.

A protein mmCIF file stores the same kind of facts for a different kind of object. It has Cartesian coordinates in ångströms, polymer chains, residue sequences, ligands from the PDB's Chemical Component Dictionary and the experiment's refinement statistics. The macromolecular dictionary was described in 1997, and the PDB's extensions to it, the PDBx part of the name, now cover crystallography, cryo-EM, NMR, integrative models and computed models such as AlphaFold predictions.

| | Small-molecule CIF | PDBx/mmCIF |
| --- | --- | --- |
| Typical contents | One crystal structure of a compound, salt or mineral | A protein, nucleic acid or complex, from experiment or prediction |
| Coordinates | Fractional, relative to the unit cell | Cartesian, in ångströms |
| Data names | Usually one underscore-joined name, such as `_cell_length_a` | Category and item separated by a period, such as `_cell.length_a` |
| Archives | IUCr journals, CSD, COD | PDB, AlphaFold Database, ModelArchive |
| Typical software | Mercury, Olex2, VESTA, Open Babel | Mol\*, PyMOL, ChimeraX, Coot, Phenix, gemmi |

Both use the `.cif` extension, so the quickest test is to open the file in a text editor. A file with `_atom_site_fract_x` columns is a small-molecule crystal structure; one with `_atom_site.Cartn_x` and `_entity_poly` is a macromolecule. For small molecules outside crystallography, the usual exchange formats are [SDF](/guides/sdf-file) and [SMILES](/guides/smiles-notation), and a small-molecule CIF converts to either.

## How a CIF file is laid out

Every CIF file is built from four pieces, and once you know them the rest of the file reads like a set of labelled tables.

- A data block starts with `data_` followed by a name, such as `data_1UBQ`, and runs until the next `data_` line or the end of the file. One file can hold several blocks.
- A data item is a name and a value on one line. The name `_cell.length_a` belongs to the `cell` category, and `length_a` is the item within it.
- A `loop_` line starts a table: a list of item names gives the columns, and the rows of values follow.
- Lines beginning with `#` are comments. A question mark marks a missing value, and a period means no value applies.

Values that contain spaces sit in single or double quotes, and longer text such as a title sits between two lines that start with a semicolon. This is the top of the mmCIF file for ubiquitin, PDB entry [1UBQ](https://www.rcsb.org/structure/1UBQ), trimmed to a few categories:
```text
data_1UBQ
#
_entry.id   1UBQ
#
loop_
_database_2.database_id
_database_2.database_code
_database_2.pdbx_database_accession
_database_2.pdbx_DOI
PDB   1UBQ         pdb_00001ubq 10.2210/pdb1ubq/pdb
WWPDB D_1000176905 ?            ?
#
_cell.length_a           50.840
_cell.length_b           42.770
_cell.length_c           28.950
#
_symmetry.space_group_name_H-M             'P 21 21 21'
#
_exptl.method            'X-RAY DIFFRACTION'
#
loop_
_atom_site.group_PDB
_atom_site.id
_atom_site.type_symbol
_atom_site.label_atom_id
_atom_site.label_alt_id
_atom_site.label_comp_id
_atom_site.label_asym_id
_atom_site.label_entity_id
_atom_site.label_seq_id
_atom_site.pdbx_PDB_ins_code
_atom_site.Cartn_x
_atom_site.Cartn_y
_atom_site.Cartn_z
_atom_site.occupancy
_atom_site.B_iso_or_equiv
_atom_site.pdbx_formal_charge
_atom_site.auth_seq_id
_atom_site.auth_comp_id
_atom_site.auth_asym_id
_atom_site.auth_atom_id
_atom_site.pdbx_PDB_model_num
ATOM   1   N N   . MET A 1 1  ? 27.340 24.430 2.614  1.00 9.67  ? 1   MET A N   1
ATOM   2   C CA  . MET A 1 1  ? 26.266 25.413 2.842  1.00 10.38 ? 1   MET A CA  1
```
The two `ATOM` rows are the same backbone nitrogen and alpha carbon of methionine 1 that open the PDB version of this entry. The values are separated by spaces, and each column's meaning comes from the `_atom_site` names above it, so a reader never counts character positions. The second row of the `database_2` table already carries the extended identifier `pdb_00001ubq`, which matters for the transition described below.

The `atom_site` table is usually the longest part, but much of an mmCIF file sits above it. These are the categories most readers look for:

| Category | What it holds | In 1UBQ |
| --- | --- | --- |
| `entity` and `entity_poly` | Each distinct molecule and the full sequence of each polymer | Ubiquitin, `MQIFVKTLTGK...` (76 residues), and water |
| `struct_asym` | Each copy of each molecule in the model | Chain `A` for the protein, `B` for the water |
| `chem_comp` | Every residue type and ligand, with its Chemical Component Dictionary code | 18 amino acids (ubiquitin has no cysteine or tryptophan) and `HOH` |
| `exptl`, `refine` | Experimental method and refinement statistics | X-ray diffraction, 1.8 Å resolution |
| `pdbx_struct_assembly` | How copies combine into the biological assembly | One monomeric assembly |
| `atom_site` | Coordinates of every atom | 602 protein atoms and 58 waters |

### Label and author identifiers

mmCIF names every atom twice. The `label_` columns are assigned by the archive and follow strict rules: every molecule copy gets its own `label_asym_id`, and polymer residues are numbered from 1 along the full deposited sequence. The `auth_` columns keep the chain names and residue numbers the authors used, which are the ones a PDB file and most papers show. The first water in 1UBQ shows the difference:
```text
HETATM 603 O O   . HOH B 2 .  ? 45.747 30.081 19.708 1.00 12.43 ? 77  HOH A O   1
```
By label, the water belongs to molecule copy `B` and has no sequence number (`.`), because it is not part of a polymer. By author, it is residue 77 of chain `A`, right after the 76 protein residues. When two programs disagree about the number of a residue in the same mmCIF file, one is almost always reading `label_seq_id` and the other `auth_seq_id`. The gap is largest for constructs numbered as in the full-length protein, where the first resolved residue might be 120 by author and 1 by label.

## PDB vs mmCIF

A PDB file defines each field by character position. That makes the format easy to read by eye, as the [guide to opening a PDB file](/guides/open-pdb-file) shows column by column, but every field has a fixed width. The atom serial number has five columns, the chain identifier one, and the residue name three. Those widths set hard limits that the archive outgrew.

| | Legacy PDB format | PDBx/mmCIF |
| --- | --- | --- |
| Atoms per file | 99,999, the largest five-digit serial | No limit |
| Chains | 62 one-character IDs (A to Z, a to z, 0 to 9) | No limit; multi-character IDs such as `Az` |
| Ligand and residue codes | Three characters | Any length, including the new five-character codes |
| PDB ID | Four characters | Four characters or the 12-character extended form |
| Field layout | Fixed columns | Named columns separated by spaces |
| Metadata | Free-text `REMARK` records for much of it | Defined categories and items for every value |
| Status | Frozen since 2012 | Archive standard since 2014, still extended |

The wwPDB stopped changing the PDB format on November 21, 2012, and made PDBx/mmCIF the archive's distribution standard in 2014. Since then, an entry gets no regular PDB file when it has more than 62 chains or more than 99,999 atoms; where possible, a bundle of smaller best-effort PDB files is offered instead. The ribosome 4V6X falls under both limits, and its chain names, two characters long, could not go in column 22 anyway. The table below gives the other dates that moved the archive to mmCIF.

| Date | Change |
| --- | --- |
| 1991 | CIF published as the IUCr standard for small-molecule crystallography |
| 1997 | Macromolecular CIF dictionary described |
| November 21, 2012 | PDB format frozen; no new content added after this date |
| 2014 | PDBx/mmCIF becomes the standard PDB archive distribution format |
| July 1, 2019 | mmCIF becomes the only accepted format for crystallographic depositions |
| December 2023 | Five-character ligand codes issued; entries that use them are distributed only in mmCIF and PDBML |
| July 21, 2027 | New entries receive only 12-character IDs and no legacy PDB files |

The 2019 rule covered X-ray, neutron, fiber and electron diffraction structures. Since late 2023, the Chemical Component Dictionary has also been issuing five-character codes for new ligands, skipping four characters so that a ligand code never looks like a PDB ID. Entries that use one exist only as mmCIF and PDBML, the archive's XML format.

The last step changes the identifiers themselves. From July 21, 2027, the wwPDB will issue only extended PDB IDs, made of `pdb_` and eight characters, and these entries will get no PDB-format file. Existing entries keep their IDs inside the longer form: `1ubq` becomes `pdb_00001ubq`. Any pipeline that downloads `.pdb` files or stores IDs in a four-character field will stop finding new structures.

## What software reads CIF files

Almost every current structural biology program reads mmCIF, and many now prefer it. PyMOL and ChimeraX download mmCIF by default when you fetch an entry by its ID. The refinement programs Phenix, REFMAC and BUSTER write it directly, and the wwPDB pointed depositors to them when mmCIF became mandatory in 2019.

Structure predictors that model ligands, nucleic acids and many chains, such as [Boltz-2](/app/boltz-2), [Protenix](/app/protenix) and [OpenFold3](/app/openfold-3), return mmCIF, and the [AlphaFold Database download](/app/alphafold-database-download) offers both formats with [pLDDT](/guides/plddt) in the B-factor column.

| Task | Software that reads mmCIF |
| --- | --- |
| View in 3D | [PDB viewer](/app/pdb-viewer) (Mol\*), PyMOL, ChimeraX, Coot |
| Check geometry and compare models | [Ramachandran plot](/app/ramachandran-plot), [RMSD calculator](/app/rmsd-calculator), [SASA calculator](/app/sasa-calculator), [DockQ](/app/dockq) |
| Extract sequences | [FASTA converter](/app/fasta-converter), which reads the chains from `atom_site` |
| Read in your own code | gemmi (C++ and Python), Biopython `MMCIFParser`, Mol\* and CIFTools (TypeScript) |
| Small-molecule CIF | Mercury, Olex2, VESTA, Open Babel |

In Python, Biopython reads an mmCIF file with one call, `MMCIFParser().get_structure("1ubq", "1ubq.cif")`, and its `MMCIF2Dict` returns every category as a dictionary for direct access to items such as `_refine.ls_d_res_high`. RCSB also serves BinaryCIF (`.bcif`), a binary encoding of the same data model. For the largest structures it is about a tenth of the size of the text file and a quarter of the gzipped one.

The gaps sit mostly in older pipelines. Docking preparation, some simulation setup steps and scripts written around fixed PDB columns may accept only `.pdb`, and those are the cases where you need to convert.

## How to convert PDB to mmCIF

[PDB to CIF](/app/pdb-to-cif) converts a `.pdb` or `.ent` file, pasted coordinates or a fetched entry to mmCIF in the browser, without uploading the file. It keeps coordinates, author chain IDs and residue numbers, insertion codes, alternate locations, occupancies and B-factors, and reports anything it had to drop. The tool's documentation lists exactly what each setting keeps.

A converted file is not the same as a deposited one. A PDB file has no entity table, so conversion cannot recreate the full sequence, the `label_` numbering or the assembly definitions that the archive's own mmCIF carries; those columns stay `?`. Most viewers and analysis tools need only the coordinates. Programs that read metadata, such as Boltz-2 when it uses a structure as a template, work better with the original archive file, which [PDB download](/app/pdb-download) fetches by ID.

On the command line, gemmi converts in either direction by file extension:
```bash
gemmi convert model.pdb model.cif
```
## How to convert mmCIF to PDB

Converting the other way works whenever the structure fits the PDB limits: 62 or fewer chains with one-character names, at most 99,999 atoms and three-character residue codes. Most single proteins, protein-ligand complexes and predicted models qualify. Any of these produces a PDB file:

- gemmi: `gemmi convert model.cif model.pdb`
- ChimeraX: `open model.cif`, then `save model.pdb`
- PyMOL: `load model.cif`, then `save model.pdb`
- Biopython: read with `MMCIFParser`, then write with `PDBIO`

The metadata does not survive the trip. Entity descriptions, assembly operators and the `label_` numbering have no place in PDB columns, and the residue numbers in the PDB file are the author numbers.

When a structure is too big, there is no lossless PDB version. gemmi can rename long chain IDs to one or two characters with `--shorten`, and `--shorten-tlc` maps five-character ligand codes to three-character aliases, but the new names no longer match the archive. Above 99,999 atoms, the serial column overflows. For archive entries, the RCSB best-effort bundles split the model into several PDB files. The more reliable fix is usually to keep the mmCIF and use a program that reads it.

A small-molecule CIF is a different conversion: from a crystal structure to a molecule file. Open Babel reads CIF and writes [SDF](/guides/sdf-file), MOL2 or SMILES, for example `obabel aspirin.cif -O aspirin.sdf`, and it also reads mmCIF for the ligands in a protein entry.

## FAQ

### How do I open a CIF file?

For a protein or nucleic acid, drop the file onto the [PDB viewer](/app/pdb-viewer) or open it in PyMOL or ChimeraX with **File**, then **Open**. For a small-molecule crystal structure, use Mercury or VESTA. Any plain-text editor shows the contents, since every CIF file is text.

### Is a CIF file the same as an mmCIF file?

They use the same syntax with different dictionaries. Small-molecule CIF describes a crystal with fractional coordinates; mmCIF describes macromolecules with chains, sequences and Cartesian coordinates. Both usually end in `.cif`, and mmCIF files sometimes use `.mmcif`.

### Why does the PDB only offer a CIF file for my structure?

The entry exceeds a PDB format limit: more than 62 chains, more than 99,999 atoms, multi-character chain IDs or a five-character ligand code. New entries that receive extended IDs from July 21, 2027 onward will be mmCIF only as well.

### Why do residue numbers differ between programs reading the same mmCIF file?

One program is reading `label_seq_id`, which counts from 1 along the deposited sequence, and the other `auth_seq_id`, the authors' numbering that also appears in the PDB file. Viewers and papers usually show the author numbers.

### Can I open a CIF file in Excel?

Excel can import it as text, but the result is rarely useful: loop tables have no fixed column count across categories, and quoted values with spaces split across cells. For tables, read the file with gemmi or Biopython's `MMCIF2Dict` and export the category you need.
