Fibroblast growth factor 21 (FGF21) is the first known endocrine signal activated by protein restriction. Although FGF21 is robustly elevated in low-protein environments, increased FGF21 is also seen in various other contexts such as fasting, overfeeding, ketogenic diets, and high-carbohydrate diets, leaving its nutritional context and physiological role unresolved and controversial. Here, we use the Geometric Framework, a nutritional modeling platform, to help reconcile these apparently conflicting findings in mice confined to one of 25 diets that varied in protein, carbohydrate, and fat content. We show that FGF21 was elevated under low protein intakes and maximally when low protein was coupled with high carbohydrate intakes. Our results explain how elevation of FGF21 occurs both under starvation and hyperphagia, and show that the metabolic outcomes associated with elevated FGF21 depend on the nutritional context, differing according to whether the animal is in a state of under- or overfeeding.