Tailed bacteriophages use nanomotors, or molecular machines that convert chemical energy into physical movement of molecules, to insert their double-stranded DNA genomes into virus particles. These viral nanomotors are powered by ATP hydrolysis and pump the DNA into a preformed protein container called a procapsid. As a result, the virions contain very highly compacted chromosomes. Here, I review recent progress in obtaining structural information for virions, procapsids and the individual motor protein components, and discuss single-molecule in vitro packaging reactions, which have yielded important new information about the mechanism by which these powerful molecular machines translocate DNA.