Which should be a greater priority: paying down the mortgage on your house or investing for retirement or other long-term financial goals? There’s no one-size-fits-all answer.

Which way would you lean? It may be as simple as knowing if you make decisions with your head or your heart.

You may get emotional and psychological satisfaction from paying off your mortgage. But paying extra on your mortgage may leave you with less money in the future. You’ll also have less time to replenish your nest egg or build up additional retirement savings.

From a purely dollars and cents view, the decision is more black and white: Will you end up with more money in your pocket by staying invested or paying off your mortgage? Here are a few things to keep in mind:

Mortgage interest rate.

The interest rate on your loan has a huge bearing on your monthly payment. The higher the rate, the more interest you pay. Since mortgage interest is typically tax-deductible and reduces your taxable income on your annual tax return, it reduces your effective mortgage rate. For example, if you’re paying a 5% interest rate on your mortgage, depending on your tax bracket, your net mortgage rate could be as low as 3.25%.

Of course, as you get closer to your mortgage payoff date, you’ll be paying more toward principal and less toward interest every month. So your interest deduction could be quite a bit lower if you’re nearing the finish line of your mortgage.

Tax bracket.

If you’re in a higher bracket, the benefit will be more pronounced; in a lower bracket, not as much. Also, if you’re not able to fully use the interest you pay each year as a deduction on your return — for example, if you don’t itemize your deductions — your net rate wouldn’t be affected as much.

Rate of investment return.

What rate of return do you need to earn to make it worthwhile to keep your money invested? The math can be complicated. You’ll want to consider the effective interest rate on your mortgage and the after-tax expected return on your investments. You’ll also want to consider the risk of your investment strategy: Your mortgage rate may be fixed but investments can fluctuate. But for many homeowners, other concerns — the satisfaction of paying off the mortgage, or the liquidity offered by savings and investment accounts — dominate.

Guaranteed returns.

Extra principal payments net a guaranteed return — a reduction in your loan amount and progress toward owning your home outright. Stock market investors have historically increased their wealth over time, but aren’t guaranteed anything.

Bottom line: No one decision is right for everyone. Your dream is likely different from your neighbor’s. It can be helpful to run some numbers specific to your situation, including your years to retirement, tax liabilities, other long-term goals, interest rates, and investment returns. Remember that your mortgage is just one piece of your larger financial plan. Get some help from your financial advisor or tax professional and make a decision that’s right for you.