BACKGROUND: The relationship between COVID-19 and epilepsy is uncertain. We studied the potential association between COVID-19 and seizures or epilepsy in the six months after infection. METHODS: We applied validated methods to an electronic health records network (TriNetX Analytics) of 81 million people. We closely matched people with COVID-19 infections to those with influenza. In each cohort, we measured the incidence and hazard ratios (HRs) of seizures and of epilepsy. We stratified data by age and by whether the person was hospitalized during the acute infection. We then explored time-varying HRs to assess temporal patterns of seizure or epilepsy diagnoses. RESULTS: We analyzed 860,934 electronic health records. After matching, this yielded two cohorts each of 152,754 patients. COVID-19 was associated with an increased risk of seizures and epilepsy compared to influenza. The incidence of seizures within 6 months of COVID-19 was 0.81% (95% CI, 0.75-0.88; HR compared to influenza 1.55 (1.39-1.74)). The incidence of epilepsy was 0.30% (0.26-0.34; HR compared to influenza 1.87 (1.54-2.28)). The HR of epilepsy after COVID-19 compared to influenza was greater in people who had not been hospitalized and in individuals aged under 16 years. The time of peak HR after infection differed by age and hospitalization status. CONCLUSIONS: The incidence of new seizures or epilepsy diagnoses in the six months following COVID-19 was low overall, but higher than in matched patients with influenza. This difference was more marked in people who were not hospitalized, highlighting the risk of epilepsy and seizures even in those with less severe infection. Children appear at particular risk of seizures and epilepsy after COVID-19 providing another motivation to prevent COVID-19 infection in pediatric populations. That the varying time of peak risk related to hospitalization and age may provide clues as to the underlying mechanisms of COVID-associated seizures and epilepsy.