To accommodate daily recurring environmental changes, animals show cyclic variations in behaviour and physiology, which include prominent behavioural states such as sleep-wake cycles but also a host of less conspicuous oscillations in neurological, metabolic, endocrine, cardiovascular and immune functions. Circadian rhythmicity is created endogenously by genetically encoded molecular clocks, whose components cooperate to generate cyclic changes in their own abundance and activity, with a periodicity of about a day. Throughout the body, such molecular clocks convey temporal control to the function of organs and tissues by regulating pertinent downstream programmes. Synchrony between the different circadian oscillators and resonance with the solar day is largely enabled by a neural pacemaker, which is directly responsive to certain environmental cues and able to transmit internal time-of-day representations to the entire body. In this Review, we discuss aspects of the circadian clock in Drosophila melanogaster and mammals, including the components of these molecular oscillators, the function and mechanisms of action of central and peripheral clocks, their synchronization and their relevance to human health.