We propose that the ancestors of bats were small, nocturnal, sylvatic gliders that used echolocation for general orientation. Their echolocation calls were short, low intensity, broadband clicks, which translated into a very short operational range. In the lineage that gave rise to bats, a switch to stronger, tonal signals permitted the use of echolocation to detect, track, and assess flying insects in subcanopy settings. We propose that these animals hunted from perches and used echolocation to detect, track, and assess flying insects, which they attacked while gliding. In this way, the perfection of echolocation for hunting preceded the appearance of flapping flight, which marked the emergence of bats. Flapping flight had appeared by the Eocene when at least eight families are known from the fossil record. Stronger signals and adaptations to minimize self-deafening were central to the perfection of echolocation for locating flying prey. Echolocation constituted a key innovation that permitted the evolution and radiation of bats. At the same time, however, its short effective range imposed a major constraint on the size of bats. This constraint is associated with flight speed and the very small time intervals from detection of, and contact with a flying target. Gleaning and high duty cycle echolocation are two derived approaches to hunting prey in cluttered situations, places where echoes from background and other objects arrive before or at the same time as echoes from prey. Both had appeared by the Eocene.