Pay off the 5% loan. The math favors loan payoff because the 5% is a guaranteed return (the interest you avoid paying), while the 4% from the HYSA is taxable income that nets out to about 3% after taxes. Net spread in favor of loan payoff: about 2 percentage points. Over $10,000 of debt, paying the loan saves about $200 a year vs. the HYSA option.

The basic math. A 5% loan costs 5% per year in interest, paid in after-tax dollars. A 4% HYSA earns 4% per year in interest, taxed at your marginal rate. At a 22% marginal tax bracket, the 4% HYSA earns 3.12% after tax. Loan payoff (5% guaranteed) beats HYSA (3.12% after tax) by 1.88 percentage points.

Concrete example on $10,000. $10,000 paid against a 5% loan saves $500 a year in interest. The same $10,000 in a 4% HYSA earns $400 a year, of which $312 is kept after 22% federal tax. Net advantage of loan payoff: $188 per year.

The tax-advantaged exception. If the 4% return is in a tax-advantaged account (Roth IRA, traditional IRA, 401(k)), the math gets closer. A 4% return in a Roth IRA is fully retained ($400 per year on $10,000). The 5% loan payoff still wins but by a smaller margin.

The opportunity cost. Money paid against the loan is not available for emergencies. If you have less than 3 months of expenses in cash, build the emergency fund first. The HYSA serves as the emergency fund.

The risk-free framing. Loan payoff is a 5% guaranteed return with no market risk. The 4% HYSA is also low-risk (FDIC insured to $250K), but the rate can change as the Federal Reserve adjusts policy.

Behavioral consideration. Some people derive emotional value from having cash savings as a buffer. Many financial planners recommend a balanced approach: maintain emergency fund of 3-6 months in HYSA, pay aggressively against loans above 4% with surplus cash.

The hybrid approach. Maintain 3-6 months emergency fund in HYSA. Direct surplus cash to loan payoff. After loans are paid off, redirect monthly cash to building wealth in tax-advantaged retirement accounts.

Practical sequence. Build emergency fund of 3 months expenses in HYSA. Pay all minimum debt payments. Direct surplus cash to highest-rate debt first until cleared.