Are you less than age 59.5?
You may wish to see a local financial planner, since this is not solely an income tax question. For example, be aware that qualified retirement plans (401(k), 403(b), IRA, etc.) are protected in bankruptcy, while homes generally are not. There may be State tax issues as well.
Given the proposed tax law changes for 2018 forward, I would tread carefully at this point.
That's not a tax question, really, so you might want to ask a retirement planner.
If you are still working and under age 59-1/2 then it will almost always be far far better to leave the retirement account alone to grow for your future. The tax penalties on early withdrawal are quite burdensome. Even if it means finding an extra source of income. Or, if you stop making new payments into the retirement accounts so you have more spending money, still leave the existing balance alone to grow.
From an economic point of view, you first want to think about your interest rate (including any discount if you itemize your deductions and deduct the interest) against the earnings from your investments. If you are very conservatively invested (3-4% return) with a high mortgage (>5%) then paying off the mortgage may save you some money in the long run. If you are making 10% returns and paying 4% (discounted to 3% by itemizing) then you make more more in earnings than you pay in interest.
Then you also need to think about the income tax on the retirement account. Even if you decide to pay off the mortgage, you might want to do it over a few years as a large lump sum withdrawal could put you in a higher tax bracket and affect your eligiblity for other tax credits and deductions that have phase-outs.
If you are under age 59-1/2 then you will pay an additional 10% penalty on the withdrawals, so your tax owed could be up to 45% on the withdrawal amount.