This post has been corrected

Tuition in the United States has skyrocketed, the job market for graduates is rough, and student debt loads are increasingly burdensome. But from a financial standpoint, a degree usually pays off. An analysis by the Federal Reserve Bank of New York finds that the value of a college degree is near its all-time high of $300,000—it’s held close to that level for nearly a decade. And even with rising tuition, the time it takes to pay off a degree is near an all-time low:

New York Federal Reserve

It took more than 20 years to pay off the costs of a four-year degree earned in the late 1970s. Now it only takes about 10 years for college graduates’ earnings to exceed the upfront investment. (The New York Fed’s calculation takes into account tuition, opportunity cost, wage premium, and the present value of cash.)

Here’s the wage gap at different education levels since 1970:

New York Federal Reserve

The rise in the relative value of a college degree seems counterintuitive given how much tuition and debt levels have risen. But since the 1980s, wages for college graduates have mostly grown, though there’s been a decline since 2000 and a sharper one since the crisis, while the wage gap with those who have only a high school diploma has gotten bigger. That’s increased the wage premium of a bachelor’s degree. And it’s greatly reduced the non-tuition cost of college—the opportunity cost of not working for four years while going to school.

But when people take more than four years to get a degree, pick less employment-focused majors, or don’t finish their schooling, expenses—in the sense of both the amount spent and the opportunity cost of not working—can increase and debt can build up.

Correction (Sept. 2): An earlier version of this incorrectly stated the direction of wage data. Figure 2 has been replaced.