As heart failure develops, the heart utilizes ketone bodies at increased rates, indicating an adaptive stress response. Thus, increasing ketone body availability exerts protective effects against heart failure. However, although it is the widely used approach for increasing ketone body availability, the ketogenic diet shows limited cardioprotective effects against heart failure. This study was aimed at examining the effects of the ketogenic diet on heart failure and the underlying mechanisms. Pressure overload-induced heart failure was established by transverse aortic constriction (TAC) in mice. Continuous ketogenic diet feeding for 8 weeks failed to protect the heart against heart failure. It showed no significant effects on cardiac systolic function and fibrosis but aggravated cardiac diastolic function in TAC mice. Specifically, it induced systemic lipid metabolic disorder and hepatic dysfunction in TAC mice. It decreased the content of 3-hydroxy-3-methylglutaryl-CoA lyase (HMGCL), a key enzyme in ketogenesis, and impaired the capacity of hepatic ketogenesis in TAC mice. It preserved the capacity of hepatic ketogenesis and exerted cardioprotective effects against heart failure, increasing cardiac function and decreasing cardiac fibrosis, in liver-specific HMGCL-overexpressed TAC mice. Importantly, we found that alternate-day ketogenic diet feeding did not impair the capacity of hepatic ketogenesis and exerted potent cardioprotective effects against heart failure. These results suggested that alternate-day but not continuous ketogenic diet protects against heart failure through preservation of ketogenesis in the liver.