For most borrowers, the answer is not student loans first or retirement first. It is both, in a specific order. The order that almost always wins is: capture every dollar of employer 401(k) match, then attack any debt above roughly 8% to 10% APR, then split your remaining surplus between continued retirement contributions and additional debt payoff. Skipping the employer match to pay down student loans is the single most common mistake in this question.
Why the employer match comes first. An employer 401(k) match is an instant return on your contribution. A typical match is 50% on the first 6% of your salary (so contributing 6% gets you a 3% bonus from your employer; the match is a 50% return on that 6%). Some employers offer 100% matches on the first 3% to 6%. The IRS limits 401(k) employee contributions to $23,500 in 2025 (with a $7,500 catch-up at 50+); the match is on top of that. No student loan interest rate above 50% exists, so capturing the match always wins. It is, in financial terms, the most important free money in personal finance.
Why high-rate debt comes second. If your student loan rate is above roughly 8% to 10%, paying it down generates a guaranteed return equal to that rate. The S&P 500's long-run total return is about 9% to 10% nominal, and after-inflation real return is about 7%. So a guaranteed 9% return (paying off a 9% loan) is roughly equivalent to a long-run market return, but with no downside. For loans above 10%, debt payoff almost certainly beats investing in expected risk-adjusted terms.
What about lower-rate federal loans? Federal Direct Loans currently carry rates from roughly 6.5% to 8% depending on the year you borrowed and the loan type (per studentaid.gov's rate table). Loans originated in 2020-2021 may be at 4.5% to 5%. For loans below 6%, the math gets closer; many financial planners recommend continuing the standard payment and prioritizing additional retirement contributions, especially if the borrower has many years to retirement. Loans below 4% are almost always lower priority than retirement for borrowers under 50.
The ages 22 to 35 specific case. A dollar contributed to a Roth IRA at age 25 is worth approximately 11x more at age 65 than a dollar contributed at 50, assuming a 7% real return. The compounding effect of starting early dwarfs almost any other financial decision. Even paying off a 12% student loan, you should not stop the employer match, because the lifetime cost of missing 10 years of compounding is greater than the interest savings on the loan.
The ages 35 to 50 case. The compounding window has shortened, but the employer match is still mandatory. After capturing the match, the relative weight of debt payoff versus additional retirement contributions depends on your retirement readiness, the loan rate, and your other financial goals. Many people in this age range run a 60/40 split (60% to retirement, 40% to additional debt payoff) or vice versa.
The ages 50 and up case. Catch-up contributions and SECURE Act 2.0 super-catch-up provisions ($11,250 for ages 60-63 in 2025) become increasingly important. Tax-advantaged accounts have a higher present value for older borrowers because the time horizon to use the tax-deferred or tax-free growth is shorter and more certain. The shorter window also makes paying off a 7%+ loan more attractive, since you may not have many compounding years left to make up the foregone investment return.
Tax considerations. Student loan interest is deductible up to $2,500 per year (subject to MAGI phase-out, currently around $80,000 single / $165,000 joint in 2025) per IRS Publication 970. The deduction is above-the-line, so it does not require itemizing. Retirement contributions to traditional 401(k)/IRA are deductible (with income limits). Roth contributions are not deductible but grow tax-free. The deductibility of loan interest reduces the effective cost of the loan slightly, which slightly favors retirement contributions in the comparison.
Income-driven repayment changes the math. If you are on an IDR plan working toward forgiveness (after 20-25 years on IDR, or 10 years on PSLF), paying extra on the loan is generally a mistake. Extra payments on a loan you expect to have forgiven simply lower the eventual forgiveness amount. Direct surplus funds to retirement instead. See our piece will student loan forgiveness actually happen in my lifetime?
The recommended order for most borrowers.
First, contribute up to the employer 401(k) match, no matter what. If your employer matches 50% on the first 6%, contribute 6%.
Second, build a $1,000 to $2,000 starter emergency fund.
Third, pay off any debt above 10% APR (most credit cards, some private student loans).
Fourth, contribute to a Roth IRA if you qualify ($7,000 limit in 2025, $8,000 with the catch-up at 50+).
Fifth, build a 3- to 6-month emergency fund.
Sixth, increase 401(k) contributions toward the annual limit ($23,500 in 2025).
Seventh, allocate any remaining surplus between paying off remaining student loans (especially anything above 6% APR) and additional taxable investing.
Special cases. If your student loans are private and high-rate (10%+) and you cannot refinance, prioritize them ahead of retirement contributions beyond the match. If you are pursuing PSLF and are confident in your career trajectory, do not pay extra; max retirement instead. If you are above the IRA income phase-outs, consider a backdoor Roth IRA strategy.
Never skip the employer match. Above that, the answer turns on your loan rate, your time horizon, and whether you're working toward forgiveness. For most borrowers under 35 with federal loans, retirement contributions plus standard payments beats aggressive payoff.