Should extra money go toward your loan or into investments? Compare the guaranteed "return" of paying off debt against your expected investment return.
Paying extra toward a loan earns you a guaranteed "return" equal to that loan's interest rate (money not spent on future interest). Investing instead aims for your expected return, which isn't guaranteed. This compares the compound value of putting the same extra money toward each option.
This is a simplified comparison of two compound growth rates — it doesn't model loan payoff timing, taxes, or investment volatility in detail. Investment returns are never guaranteed the way a loan's interest rate reduction is. Not financial advice.