Cyclophilins are peptidyl-prolyl cis/trans isomerases (PPIase) that catalyse the interconversion of the peptide bond at proline residues. Several cyclophilins play a pivotal role in the life cycle of a number of viruses. The existing cyclophilin inhibitors, all derived from cyclosporine A or sanglifehrin A, have disadvantages, including their size, potential for side effects unrelated to cyclophilin inhibition and drug–drug interactions, unclear antiviral spectrum and manufacturing issues. Here we use a fragment-based drug discovery approach using nucleic magnetic resonance, X-ray crystallography and structure-based compound optimization to generate a new family of non-peptidic, small-molecule cyclophilin inhibitors with potent in vitro PPIase inhibitory activity and antiviral activity against hepatitis C virus, human immunodeficiency virus and coronaviruses. This family of compounds has the potential for broad-spectrum, high-barrier-to-resistance treatment of viral infections.