Concentrations of acetyl-coenzyme A and nicotinamide adenine dinucleotide (NAD+) affect histone acetylation and thereby couple cellular metabolic status and transcriptional regulation. We report that the ketone body D-β-hydroxybutyrate (βOHB) is an endogenous and specific inhibitor of class I histone deacetylases (HDACs). Administration of exogenous βOHB, or fasting or calorie restriction, two conditions associated with increased βOHB abundance, all increased global histone acetylation in mouse tissues. Inhibition of HDAC by βOHB was correlated with global changes in transcription, including that of the genes encoding oxidative stress resistance factors FOXO3A and MT2. Treatment of cells with βOHB increased histone acetylation at the Foxo3a and Mt2 promoters, and both genes were activated by selective depletion of HDAC1 and HDAC2. Consistent with increased FOXO3A and MT2 activity, treatment of mice with βOHB conferred substantial protection against oxidative stress.