Monthly car repayment formula

Calculate the monthly interest rate:
$r = \frac{\text{Annual Interest Rate}}{12}$ 
Calculate the loan amount after deposit:
$L = \text{Loan Amount}  \text{Deposit}$ 
Calculate the monthly installment without considering the residual:
$M = \frac{L \times r}{1  (1 + r)^{\text{Months}}}$ 
Calculate the present value of the residual:
$PV_{\text{residual}} = \frac{\text{Residual}}{(1 + r)^{\text{Months}}}$ 
Calculate the monthly installment considering the residual:
$M_{\text{with residual}} = \frac{L  PV_{\text{residual}} \times r}{1  (1 + r)^{\text{Months}}}$
Where:
 $r$ is the monthly interest rate.
 $L$ is the loan amount after deducting the deposit.
 $M$ is the monthly installment without considering the residual.
 $PV_{\text{residual}}$ is the present value of the residual.
 $M_{\text{with residual}}$ is the monthly installment considering the residual.
This formula assumes that the interest rate is compounded monthly. The residual (or balloon payment) is the amount that remains unpaid at the end of the loan term and must be paid in a lump sum.
The formula used by your financial institution may vary
The below calculator uses the formula