Background: A prior hospitalization resulting from heart failure is associated with poor outcomes in ambulatory patients with heart failure. Less is known about this association in hospitalized patients with heart failure and whether it varies by ejection fraction. Methods: Of the 25,345 hospitalized patients in the Medicare-linked OPTIMIZE-HF registry, 22,491 had known heart failure, of whom 7648 and 9558 had heart failure with preserved (≥ 50%) and reduced (≤ 40%) ejection fraction (HFpEF and HFrEF), respectively. Overall, 927 and 1862 patients with HFpEF and HFrEF had hospitalizations for heart failure during the 6 months before the index hospitalization, respectively. Using propensity scores for prior heart failure hospitalization, we assembled two matched cohorts of 924 pairs and 1844 pairs of patients with HFpEF and HFrEF, respectively, each balanced for 58 baseline characteristics. Cox regression models were used to estimate hazard ratios (HRs) and 95% confidence intervals (CIs) for outcomes during 6 years of follow-up. Results: Among 1848 matched patients with HFpEF, HRs (95% CIs) for all-cause mortality, all-cause readmission, and heart failure readmission were 1.35 (1.21-1.50; P < 0.001), 1.34 (1.21-1.47; P < 0.001), and 1.90 (1.67-2.16; P < 0.001), respectively. Respective HRs (95% CIs) in 3688 matched patients with HFrEF were 1.17 (1.09-1.26; P < 0.001), 1.32 (1.23-1.41; P < 0.001), and 1.48 (1.37-1.61; P < 0.001). Conclusions: Among hospitalized patients with heart failure, a previous hospitalization for heart failure is associated with higher risks of mortality and readmission in both HFpEF and HFrEF. The relative risks of death and heart failure readmission appear to be higher in HFpEF than in HFrEF.