Simple JQuery Mortgage Calculator

Servee is moving into real estate territory, more details to come, but I've made this simple mortgage calculator. Free to use, no warranty, etc.

Here is the code for your copy and paste, check the example below. It requires Jquery to function. My styles also may mess up the line breaks in the HTML, but the JS is all pretty short, so it's not a big deal.

<!-- if you don't have jquery -->
<script type='text/javascript' src=''></script>

<!--The following formula is used to calculate the fixed monthly payment (P) required to fully amortize a loan of L dollars over a term of n months at a monthly interest rate of c. [If the quoted rate is 6%, for example, c is .06/12 or .005].

P = L[c(1 + c)^n]/[(1 + c)^n - 1]-->
<h3>Mortgage Calculator</h3>
<form >
<p> <input type="text" name="mcPrice" id="mcPrice" class="mortgageField" />
Sale price ($)
<p> <input type="text" name="mcDown" id="mcDown" class="mortgageField" />
Down payment (%)</p>
<p> <input type="text" name="mcRate" id="mcRate" class="mortgageField" />
Interest Rate (%)</p>
<p> <input type="text" name="mcTerm" id="mcTerm" class="mortgageField" />
Term (years)</p>
<button class="smallButton" id="mortgageCalc" onclick="return false">Calculate Monthly Payment</button>
<input type="text" name="mcPayment" id="mcPayment" class="mortgageAnswer" />
<script type="text/javascript">
var L,P,n,c,dp;
L = parseInt($("#mcPrice").val());
n = parseInt($("#mcTerm").val()) * 12;
c = parseFloat($("#mcRate").val())/1200;
dp = 1 - parseFloat($("#mcDown").val())/100;
L = L * dp;
P = (L*(c*Math.pow(1+c,n)))/(Math.pow(1+c,n)-1);
$("#mcPayment").val('There was an error');
return false;

Mortgage Calculator Example

Sale price ($)

Down payment (%)

Interest Rate (%)

Term (years)

Comments and Messages

I won't ever give out your email address. I don't publish comments but if you'd like to write to me then you could use this form.

Issac Kelly