LoanGeek.net a Simple Online Mortgage Calculator

I'm currently in the process of buying a house and (for those of you who don't know) it is a royal pain in the ass. Everywhere you turn you are expected to make a potentially life altering decision about something you know nothing about and will end up costing you well over three times what you gross in a year. So yes, it's a bit stressful. But, I digress.

One of the more complicated aspects of purchasing a new home is understanding the loan process. In fact, the total monthly cost of a house is much more than the simple principal/interest type loan you get when you buy a car or borrow money for education. In fact, there are several other factors that add up to the total monthly payment of a home.

For instance, most loans require you to have "Mortgage Insurance" or PMI if you don't have 20% equity in your home. This means that you have to pay a 1% per year premium on your house until you own enough of your house that you are no longer a huge liability.

Also, you have costs like property tax (another 2.3+%), insurance, HOA dues, and the list goes on and on.

So, to combat the intense stress of buying a new home and force myself to understand exactly what is going on behind the scenes I decided to create my own mortgage calculator application to break down precisely what my payment would be under a specific set of circumstances.

Are there other mortgage calculators out there? Sure. But, most of them are ugly, riddled with adds, and don't take all of the different monthly costs into account.

So, without further ado, I present to you LoanGeek.

The source code is available on Github.

Also, for those of you who are interested. This is how I calculated the principal and interest payments. I got the formula off of Hugh Chou's website.

/**
 * How to Calculate Loan Amortization Schedules/Tables by Hand
 * http://www.hughchou.org/calc/formula.html
 * 
 * P = Principal
 * I = Annual interest rate
 * L = Loan Term (years)
 * 
 * J = Monthly interest in decimal form. 
 * J = I / (12 * 100)
 * 
 * N = Number of months over which the loan is amortized.
 * N = L * 12
 * 
 * M = Monthly Payment
 * 
 * M = P * ( J / ( 1 - (1 + J)^-N ) )
 */
private double CalculatePrincipalAndInterest() {
  double principalAndInterest = 0.0;

  MonthlyInterestMultiplier = InterestRate / (12 * 100);
  AmortizedMonths = LoanTerm * 12;

  double amortizedExpression = (1 - (Math.Pow((1 + MonthlyInterestMultiplier), -AmortizedMonths)));
  principalAndInterest = Principal * (MonthlyInterestMultiplier / amortizedExpression);

  InterestOnlyMonthly = Principal * MonthlyInterestMultiplier;
  PrincipalOnlyMonthly = principalAndInterest - InterestOnlyMonthly;

  return principalAndInterest;
}

If you are buying a house soon, I hope that you find this useful.

Creative Commons License

What do you think?