Guidelines recommend effective on-demand therapy for all individuals with hereditary angioedema. We aimed to assess the novel oral plasma kallikrein inhibitor, sebetralstat, which is in development, for on-demand treatment of hereditary angioedema attacks. In this two-part phase 2 trial, individuals with type 1 or 2 hereditary angioedema aged 18 years or older were recruited from 25 sites, consisting of specialty outpatient centres, across nine countries in Europe and the USA. Individuals were eligible if they had experienced at least three hereditary angioedema attacks in the past 93 days, were not on prophylactic therapy, and had access to and the ability to self-administer conventional attack treatment. In part 1 of the trial, participants were given a single 600 mg open-label oral dose of sebetralstat to assess safety, pharmacokinetics, and pharmacodynamics of the dose. Part 2 was a randomised, double-blind, placebo-controlled, two-sequence, two-period (2 × 2) crossover trial; participants were randomly assigned (1:1) to either sequence 1, in which they were given a single dose of 600 mg of sebetralstat to treat the first eligible attack and a second dose of placebo to treat the second eligible attack, or sequence 2, in which they were given placebo to treat the first eligible attack and then 600 mg of sebetralstat to treat the second eligible attack. Participants and investigators were masked to treatment assignment. The primary endpoint was time to use of conventional attack treatment within 12 h of study drug administration, which was assessed in all participants who were randomly assigned to treatment and who received study drug for two attacks during part 2 of the study. Safety was assessed in all participants who received at least one dose of study drug, starting in part 1. This study is registered with ClinicalTrials.gov, NCT04208412, and is completed. Between July 2, 2019, and Dec 8, 2020, 84 individuals were screened and 68 were enrolled in part 1 and received sebetralstat (mean age 38·3 years [SD 13·2], 37 [54%] were female, 31 [46%] were male, 68 [100%] were White). 42 (62%) of 68 participants completed pharmacokinetic assessments. Sebetralstat was rapidly absorbed, with a geometric mean plasma concentration of 501 ng/mL at 15 min. In a subset of participants (n=6), plasma samples obtained from 15 min to 4 h after study drug administration had near-complete protection from ex vivo stimulated generation of plasma kallikrein and cleavage of high-molecular-weight kininogen. In part 2, all 68 participants were randomly assigned to sequence 1 (n=34) or sequence 2 (n=34). 53 (78%) of 68 participants treated two attacks (25 [74%] in the sequence 1 group and 28 [82%] in the sequence 2 group). Time to use of conventional treatment within 12 h of study drug administration was significantly longer with sebetralstat versus placebo (at quartile 1: >12 h [95% CI 9·6 to >12] vs 8·0 h [3·8 to >12]; p=0·0010). There were no serious adverse events or adverse event-related discontinuations. Oral administration of sebetralstat was well tolerated and led to rapid suppression of plasma kallikrein activity, resulting in increased time to use of conventional attack treatment and faster symptom relief versus placebo. Based on these results, a phase 3 trial to evaluate the efficacy and safety of two dose levels of sebetralstat in adolescent and adult participants with hereditary angioedema has been initiated (NCT05259917). KalVista Pharmaceuticals.