# What is the formula for loan payoff date?

My goal is to calculate loan payoff date. Actually I'm making a wordpress plugin to calculate that. I made a form from I can have following inputs from user.

Current Loan Information

``````Original Balance
Current Balance
Interest Rate
Term (Years)
Payment Amount
``````

New Line of Credit Information

``````Chunk Amount
LOC Interest Rate
``````

Other Info like Monthly Income, Living Expenses, Start Date etc.

Can I calculate approx. loan payoff date? If somebody has formula for in simple math terms?

• What have you tried and where are you stuck specifically - please edit your question. – user71981 Dec 4 '18 at 10:29
• The payoff date would just be the origination date plus the number of periods. Or you talking about paying the loan off early using the line of credit? You can't pay off debt early by borrowing more money. – D Stanley Dec 4 '18 at 15:43
• @D Stanley: No, but you can pay off debt that's a high interest rate by borrowing at a lower rate. For instance, refinancing a mortage when interest rates were low. – jamesqf Dec 4 '18 at 18:34

With

``````s = principal
r = periodic rate
d = periodic payment
n = number of periods
``````

the basic loan formula is

``````s = (d - d (1 + r)^-n)/r
``````

Rearranging for the number of periods

``````n = -(Log[1 - (r s)/d]/Log[1 + r])
``````

The balance remaining in period `x` is

``````(d + (1 + r)^x (r s - d))/r
``````

For example

``````s = 100000
r = 0.05/12
d = 1000

n = -(Log[1 - (r s)/d]/Log[1 + r]) = 129.628

x = 129

balance in period 129 = (d + (1 + r)^x (r s - d))/r = 626.35
``````

This would result in a final payment in period 130 less than the usual 1000.

``````(1 + r) 626.35 = 628.96
``````

Conversely if the balance in period 129 is small it may be added to the usual payment and the loan would end in 129 periods.

The payoff date would simply be Today's Date (e.g. =TODAY() in Excel) plus the number of months the loan is for (24 months, 36 months, 360 mths, etc). Assuming the individual makes no additional principle payments that is of course.

If you need help calculating this in PHP, I'd suggest you hop over to StackOverflow and post your question there - but I'd bet this sort of thing is answered already. Good luck!