Developmental and epileptic encephalopathies are devastating disorders characterized by epilepsy, intellectual disability, and other neuropsychiatric symptoms, for which available treatments are largely ineffective. Following a precision medicine approach, we show for KCNA2-encephalopathy that the K + channel blocker 4-aminopyridine can antagonize gain-of-function defects caused by variants in the K V1.2 subunit in vitro, by reducing current amplitudes and negative shifts of steady-state activation and increasing the firing rate of transfected neurons. In n-of-1 trials carried out in nine different centers, 9 of 11 patients carrying such variants benefitted from treatment with 4-aminopyridine. All six patients experiencing daily absence, myoclonic, or atonic seizures became seizure-free (except some remaining provoked seizures). Two of six patients experiencing generalized tonic-clonic seizures showed marked improvement, three showed no effect, and one worsening. Nine patients showed improved gait, ataxia, alertness, cognition, or speech. 4-Aminopyridine was well tolerated up to 2.6 mg/kg per day. We suggest 4-aminopyridine as a promising tailored treatment in KCNA2-(gain-of-function)–encephalopathy and provide an online tool assisting physicians to select patients with gain-of-function mutations suited to this treatment.