Introduction: Treatment of compulsive exercise is recognized as a key unmet challenge in the treatment of anorexia nervosa (AN). To address this challenge, we developed the manualized group intervention "healthy exercise behavior" (HEB). This study evaluates the efficacy of HEB for the reduction of compulsive exercise as add-on to routine inpatient treatment (treatment as usual [TAU]) in a randomized controlled trial. Methods: Two hundred and seven adolescent and adult female inpatients with (atypical) AN were randomly allocated to TAU or to additional participation in HEB (TAU + HEB). HEB integrates elements of exercise-based therapy into a cognitive-behavioral approach. Assessments took place at admission, pre-intervention, post-intervention, discharge, and 6 months follow-up. Primary outcome was the severity of compulsive exercise assessed by the Commitment to Exercise Scale between pre-and post-intervention; secondary outcomes were additional aspects of compulsive exercise, assessed by the Compulsive Exercise Test, weight gain, eating disorder and general psychopathology, and emotion regulation. Results: In intention-to-treat analysis for the primary outcome, the TAU + HEB group showed significantly stronger reductions in the severity of compulsive exercise compared to the TAU group (z = -2.81; p = 0.005; effect size [ES] = -0.3). We also found significantly stronger reductions from admission to discharge (z = 2.62; p = 0.009; ES = -0.43), and from admission to follow-up (z = 2.1; p = 0.035; ES = -0.39). Regarding secondary outcomes, we found significant group differences between pre-and post-intervention in additional aspects of compulsive exercise (z = -2.55; p = 0.011; ES = -0.27). We did not find significant differences regarding weight gain, eating disorder and general psychopathology, and emotion regulation. Conclusions: Our intervention proved efficacious in reducing compulsive exercise in inpatients with (atypical) AN.