Escaping from imminent danger is an instinctive behaviour that is fundamental for survival, and requires the classification of sensory stimuli as harmless or threatening. The absence of threat enables animals to forage for essential resources, but as the level of threat and potential for harm increases, they have to decide whether or not to seek safety 1 . Despite previous work on instinctive defensive behaviours in rodents2-11, little is known about how the brain computes the threat level for initiating escape. Here we show that the probability and vigour of escape in mice scale with the saliency of innate threats, and are well described by a model that computes the distance between the threat level and an escape threshold. Calcium imaging and optogenetics in the midbrain of freely behaving mice show that the activity of excitatory neurons in the deep layers of the medial superior colliculus (mSC) represents the saliency of the threat stimulus and is predictive of escape, whereas glutamatergic neurons of the dorsal periaqueductal grey (dPAG) encode exclusively the choice to escape and control escape vigour. We demonstrate a feed-forward monosynaptic excitatory connection from mSC to dPAG neurons, which is weak and unreliable-yet required for escape behaviour-and provides a synaptic threshold for dPAG activation and the initiation of escape. This threshold can be overcome by high mSC network activity because of short-term synaptic facilitation and recurrent excitation within the mSC, which amplifies and sustains synaptic drive to the dPAG. Therefore, dPAG glutamatergic neurons compute escape decisions and escape vigour using a synaptic mechanism to threshold threat information received from the mSC, and provide a biophysical model of how the brain performs a critical behavioural computation.