At altitude, air pressure is lower, water boils cooler, and liquid evaporates faster. Each of those pushes a baked good in a different wrong direction, which is why a cake that works at sea level collapses in Denver.
Three separate problems
Lower pressure means the gas bubbles that leavening produces expand more for the same amount of gas. A batter that rises beautifully at sea level over-expands and then collapses, because the structure has not set by the time the bubbles get too big to support.
Water boils at a lower temperature — about 202 degrees Fahrenheit at 5,000 feet rather than 212 — so moisture leaves the batter faster and the interior sets at a lower temperature.
Faster evaporation concentrates the sugar, and sugar weakens gluten. So the same recipe ends up proportionally sweeter and structurally weaker at the same time.
Less leavening, not more
This is the counterintuitive one. The instinct at altitude is that things do not rise, so add more baking powder. The opposite is correct.
The gas already expands more than it does at sea level. Adding more produces a cake that rises dramatically and then falls in the middle, with a coarse open crumb and a sunken top.
The published reduction is about an eighth of a teaspoon per teaspoon between 3,500 and 6,500 feet, and up to a quarter above 8,500. On a two-teaspoon recipe that is a meaningful change.
A hotter oven, for less time
Raising the oven 15 to 25 degrees Fahrenheit sets the protein structure sooner, which locks the crumb in place before the bubbles over-expand.
Because the oven is hotter, the bake is shorter — roughly five to eight minutes less per thirty. Both changes work together and neither works alone.
This is the adjustment with the biggest effect for the least effort, and it is worth trying first on a recipe that has failed once.
Where these numbers come from
The bands here are from Colorado State University Extension, which publishes the guide most other sources cite. King Arthur Baking publishes closely comparable figures, and the two agree on oven temperature and sugar.
They are ranges rather than single values because the correct adjustment inside a band depends on the recipe. A lean, simple batter needs less correction than a rich one with a lot of sugar and fat.
Nobody publishes a formula, and anyone who does is inventing precision that the underlying science does not support.
What is barely affected
Yeast breads need much less adjustment than cakes. Fermentation is slower and self-correcting, and the main change is that dough proves faster — so watch the dough rather than the clock, and consider a cooler, longer proof.
Cookies, brownies and anything dense are fairly tolerant. They have little structure to collapse.
The most sensitive are angel food cake, chiffon, soufflé and anything leavened mainly by whipped egg white. Those are worth finding an altitude-specific recipe for rather than adjusting.