Hoopoes are widespread in Europe, Asia, and North Africa, Sub-Saharan Africa and Madagascar. Most European and north Asian birds migrate to the tropics in winter. In contrast, the African populations are sedentary all year. The species has been a vagrant in Alaska; U. e. saturata was recorded there in 1975 in the Yukon Delta. Hoopoes have been known to breed north of their European range, and in southern England during warm, dry summers that provide plenty of grasshoppers and similar insects, although as of the early 1980s northern European populations were reported to be in the decline, possibly due to changes in climate.
The hoopoe has two basic requirements of its habitat: bare or lightly vegetated ground on which to forage and vertical surfaces with cavities (such as trees, cliffs or even walls, nestboxes, haystacks, and abandoned burrows) in which to nest. These requirements can be provided in a wide range of ecosystems, and as a consequence the hoopoe inhabits a wide range of habitats such as heathland, wooded steppes, savannas and grasslands, as well as forest glades. The Madagascar subspecies also makes use of more dense primary forest. The modification of natural habitats by humans for various agricultural purposes has led to hoopoes becoming common in olive groves, orchards, vineyards, parkland and farmland, although they are less common and are declining in intensively farmed areas. Hunting is of concern in southern Europe and Asia.
Hoopoes make seasonal movements in response to rain in some regions such as in Ceylon and in the Western Ghats. Birds have been seen at high altitudes during migration across the Himalayas. One was recorded at about 6,400 m (21,000 ft) by the first Mount Everest expedition.