Objective: To compare the efficacy of remimazolam and propofol on hemodynamics and quality of early postoperative recovery in elderly patients with frailty undergoing endoscopic retrograde cholangiopancreatography (ERCP). Methods: A total of 108 elderly patients with frailty (aged≥75 years) undergoing elective ERCP in the General Hospital of Northern Theater Command were prospectively enrolled from November 2022 to May 2023. According to the different anesthetic drugs used, the patients were divided into two groups by random number table method: remimazolam group (group R) and propofol group (group P). The group R was given remimazolam 0.15-0.20 mg/kg and alfentanil 5.0 μg/kg for anesthesia onset, and then was pumped remimazolam 0.4-0.8 mg·kg-1·h-1 and alfentanil 0.5 μg·kg-1·min-1 to maintain sedation. The group P was given propofol 1.0-1.5 mg/kg and alfentanil 5.0 μg/kg, and was pumped propofol 2.0-6.0 mg·kg-1·h-1 and alfentanil 0.5 μg·kg-1·min-1. The primary outcome was the incidence of intraoperative hypotension [mean arterial pressure (MAP)<65 mmHg (1 mmHg=0.133 kPa) or MAP>20% decrease from baseline value] and severe hypotension (MAP<55 mmHg) in both groups, and other outcomes included: MAP, heart rate, pulse oxygen saturation (SpO2) and bispectral index (BIS) values of patients at each time of before anesthesia induction (T0), 1 min after anesthesia induction (T1), endoscope through the oropharynx (T2), immediate lithotomy (T3), endoscope withdrawal from the oropharynx (T4), and patients awake (T5); the use of vasoactive drug during operation; the incidence of bradycardia, hypoxemia and injection pain; and the postoperative 15-item Quality of Recovery (QoR-15) score. Results: Group R included 33 males and 20 females, aged (81.5±4.9) years. Group P included 26 males and 29 females, aged (82.3±6.0) years. The incidence of intraoperative hypotension in group R was 24.5% (13/53), which was lower than 43.6% (24/55) in group P (P=0.036), there was no significant difference of the incidence of severe hypotension which was 0 (0/53) and 5.5% (3/55) (P=0.225). Compared with T0, MAP and BIS decreased at T1-T4 (both P<0.05); heart rate and SpO2 decreased at T1-T2 in both groups (both P<0.05). Compared with group P, MAP increased at T1-T4; heart rate, SpO2 and BIS increased in group R (all P<0.05). The use of intraoperative vasoactive drug in group R was (93.9±21.4) μg, lower than (123.3±29.7) μg in group P (P<0.001), and the incidence of bradycardia, hypoxemia and injection pain in group R was 5.7% (3/53), 13.2% (7/53), and 3.8% (2/53), lower than 18.2% (10/55), 30.9% (17/55), and 16.4% (9/55) in group P (all P<0.05). There was no significant difference in the incidence of bucking or involuntary body movement and hiccuping in both groups (both P>0.05). The awakening time in group R was (11.8±3.0) min, longer than (10.3±3.3) min in group P (P=0.016), and the incidence of emergence agitation was 3.8% (2/53), lower than 16.4% (9/55) (P=0.031). There was no significant difference in postanesthesia care unit (PACU) stay duration and the incidence of postoperative nausea and vomiting in both groups (all P>0.05). The postoperative QoR-15 scores at 1 d were (131.9±4.7) and (129.3±5.7) with statistically significant difference (P=0.010), and QoR-15 scores at 3 d were (134.8±3.3) and (133.6±5.0) with no significant difference (P=0.205). Conclusions: Compared with propofol, remimazolam reduces the incidence of intraoperative hypotension, bradycardia, injection pain and the use of intraoperative vasoactive drug on elderly patients with frailty undergoing ERCP. Remimazolam has relatively stable hemodynamics, it prolongs the recovery time but does not significantly affect the quality of early postoperative recovery.