No description or website provided.
Pull request Compare This branch is 2 commits behind paragjoshi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



While there are several web based calculators for finding loan payment, nothing beats the simplicity, speed and efficiency of good old command-line!

In my opinion, executing pmt 250000 is way faster than lauching browser, going to a website and finding your way around the GUI while ignoring all those annoying advertisements!


This simple program is implemented in Ruby and also can serve as an example ruby program while being a little more advanced than commonly known Hello World program!

System Requirements

  1. You need a Ruby interpreter to run this program.
  2. On Debian / Ubuntu run:
    • sudo apt-get install ruby


$  ./pmt <LoanAmt> [Rate] [LoanDurationMonth/Years] [TaxRate]

or, on non-*nix platforms, assuming the Ruby interpreter is already installed, execute:

c:/>  ruby ./pmt <LoanAmt> [Rate] [LoanDuration][Month/Years] [TaxRate]

All parameters in [] are optional. LoanAmt is the only required parameter.

By default, LoanDuration is considered in years but you can specify in months by adding m at the end. For instance, a value 15 would be 15 years but 16m would be considered 16 months.

TaxRate is used for loan transactions where tax may be applied as a percentage of the loan amount. For instance, in the case of real estate purchase, typically property tax is payable as a percentage of purchase price of home. When a down payment is made, the house value considered would be different than the loan principal amount.

Default values

If the optional parameters are not supplied the following default values are taken:

Parameter Default Value
Rate 6%
Duration 30 years
Tax Rate 1%


Example 1:

$ ./pmt 450000 5.5 20

This would compute the loan payment and tax on 450,000 (in your favorite currency) at 5.5% per year interest rate for a 20 year loan duration.

The following would be the output:

Interest Rate=5.5
Loan Payment=3095.49288536656
Total Payment(including tax)=3470.49288536656

Example 2:

$ ./pmt 450000 5.5 36m 2

This would calculate the same loan for 36 months duration with 2% tax rate.

The following would be the output:

Interest Rate=5.5
Loan Payment=13588.1558119395
Total Payment(including tax)=13963.1558119395


All the code, documents and related content for this project is released under the GNU AFFERO GENERAL PUBLIC LICENSE. For more information please refer to the included LICENSE file.


Please feel free to send feedback, report bugs or request enhancements on the GitHub issue tracker.