Dyneins are large microtubule motor proteins required for mitosis, intracellular transport and ciliary and flagellar motility. They generate force through a power-stroke mechanism, which is an ATP-consuming cycle of pre- and post-power-stroke conformational changes that cause relative motion between different dynein domains. However, key structural details of dynein's force generation remain elusive. Here, using cryo-electron tomography of intact, active (that is, beating), rapidly frozen sea urchin sperm flagella, we determined the in situ three-dimensional structures of all domains of both pre- and post-power-stroke dynein, including the previously unresolved linker and stalk of pre-power-stroke dynein. Our results reveal that the rotation of the head relative to the linker is the key action in dynein movement, and that there are at least two distinct pre-power-stroke conformations: pre-I (microtubule-detached) and pre-II (microtubule-bound). We provide three-dimensional reconstructions of native dyneins in three conformational states, in situ, allowing us to propose a molecular model of the structural cycle underlying dynein movement.