Also my current mortgage rate is at 4.125% which is a bit lower than my student loan (4.5%)
Last year, I paid $11,700 in interest rate for my mortgage and $9100 in interest rate for my student loans.
...how do you calculate the after-tax interest rate?
It's actually a little bit complex, but not too bad. For mortgage interest, you need to know how much of your interest is being used for itemized deductions. Then multiply your mortgage interest rate times "fraction of interest
not used for itemized deductions plus 'fraction used for itemized deductions times (1 - marginal tax rate)'".
E.g., if your state income tax alone is $1000 less than the standard deduction for your federal return, and state tax and mortgage interest are your only itemized deductions, and you don't make so much that your itemized deductions are limited..., your after tax interest rate is
4.125% * (1000/11700 + 10700/11700*(1-0.373)) = 4.125% * .659 = 2.72%
The student loan calculation is similar. Here you don't need to worry about the standard deduction (because SL interest is deducted on the first page of form 1040), but you do need to recognize the upper limit(s) on SL interest deduction: 1) you can't deduct any more than $2500/yr, and 2) if your income is too high you can't deduct any of it. Again assuming your income is not too high, multiply your SL interest rate times "fraction of interest
not used for deduction plus 'fraction used for deduction times (1 - marginal tax rate)'".
E.g., for the numbers given above, your after tax interest rate is
4.5% * ((9100-2500)/9100 + 2500/9100*(1-0.373)) = 4.5% * .898 = 4.04%
If the numbers here are accurate, then between the two it is clear that the SL should be paid before the mortgage. Whether to prepay either, vs. invest, is the subject of much discussion....