Viruses are nanosized, genome-filled protein containers with remarkable thermodynamic and mechanical properties. They form by spontaneous self-assembly inside the crowded, heterogeneous cytoplasm of infected cells. Self-assembly of viruses seems to obey the principles of thermodynamically reversible self-assembly but assembled shells ('capsids') strongly resist disassembly. Following assembly, some viral shells pass through a sequence of coordinated maturation steps that progressively strengthen the capsid. Nanoindentation measurements by atomic force microscopy enable tests of the strength of individual viral capsids. They show that concepts borrowed from macroscopic materials science are surprisingly relevant to viral shells. For example, viral shells exhibit 'materials fatigue- and the theory of thin-shell elasticity can account - in part - for atomic-force-microscopy-measured force-deformation curves. Viral shells have effective Young's moduli ranging from that of polyethylene to that of plexiglas. Some of them can withstand internal osmotic pressures that are tens of atmospheres. Comparisons with thin-shell theory also shed light on nonlinear irreversible processes such as plastic deformation and failure. Finally, atomic force microscopy experiments can quantify the mechanical effects of genome encapsidation and capsid protein mutations on viral shells, providing virological insight and suggesting new biotechnological applications. © 2010 Macmillan Publishers Limited. All rights reserved.