Ethnopharmacological relevance Hypecoum erectum has been used extensively in folk medicine to treat inflammation, fever, and pain. However, few investigations have been carried out on the biological activities related to its traditional use. The chemical constituents of this plant along with their anti-inflammatory and analgesic effects have yet to be revealed. Aim of the study This study aimed to support the traditional use of H. erectum by first assessing its anti-inflammatory and analgesic effects and then investigating its chemical constituents to identify any anti-inflammatory and/or analgesic compounds. Material and methods The in vivo anti-inflammatory and analgesic activities of the MeOH extract (ME), total alkaloid (AL), and non-alkaloid (Non-AL) fractions of H. erectum at doses of 200, 100, and 50 mg/kg and four major constituents (20, 21, 22, and 27) at doses of 100 and 50 mg/kg delivered via intragastrical administration were evaluated using carrageenan-induced paw edema and acetic acid-stimulated writhing animal models. A phytochemical study of the bioactive (AL) fraction was conducted using various chromatographic techniques, and the structures of the obtained isoquinolines were identified by multiple spectroscopic analyses and quantum chemical computations. Moreover, the anti-inflammatory activities of all the isolates were assessed in vitro based on the suppression of lipopolysaccharide-activated inflammatory mediators (COX-2, IL-1β, and TNF-α) in RAW 264.7 macrophage cells. Results At the dose of 200 mg/kg, the three fractions (ME, AL, and Non-AL) of H. erectum ameliorated the paw edema by carrageenan-stimulated and reduced the number of writhing by acetic acid-induced in mice compared to the model group, with the AL fraction showing the most potent effects. Subsequent phytochemical investigation of the AL fraction led to the isolation of six new isoquinoline alkaloids (1–6) as well as 23 known analogues (7–29). However, compared to common isoquinolines, compounds 1–4 possess an additional nitrogen atom, while compound 5 has two additional nitrogen atoms. These additional atoms enrich the diversity of natural isoquinoline alkaloids. Further pharmacological evaluation in vivo revealed that the four major constituents (20, 21, 22, and 27) significantly relieved paw edema at 100 mg/kg, while protopine (20) and oxyhydrastinin (27) remarkably decreased the number of writhing at 100 mg/kg. In addition, most of the isolates displayed anti-inflammatory effects, as indicated by the inhibition of inflammatory mediators (COX-2, IL-1β, and/or TNF-α) in vitro at a treatment concentration of 5 μg/mL. trans-benzindenoazepines (13), protopine (20), and 1,3,6,6-tetramethyl-5,6,7,8-tetrahyboisoquiolin-8-one (25) showed comparable anti-inflammatory activity to dexamethasone by inhibiting the secretion of IL-1β. Conclusions This investigation validated the traditional use of H. erectum by assessing its anti-inflammatory and analgesic effects. Phytochemical investigation revealed the diversity and novelty of the natural isoquinoline alkaloids in H. erectum. Four major isoquinolines were identified as the bioactive constituents of H. erectum. The findings provide scientific justification to support the traditional application of H. erectum for treating inflammatory and pain disorders.