Paying off a 6% loan is mathematically identical to a guaranteed 6% return — there's no risk of loss. Investing at an "expected" 7% return isn't guaranteed; markets can underperform, especially over shorter time horizons. Many people choose to pay off debt even when its rate is a bit lower than expected investment returns, specifically to avoid that risk.
No — retirement accounts, employer matching, and tax deductions can change the effective comparison significantly (e.g. free employer match money often beats any loan payoff). Factor those in separately if they apply to you.
This tool only compares the math. Being debt-free has psychological and practical value (more monthly cash flow flexibility, less stress) that isn't captured in a pure numbers comparison — factor that into your own decision.