# Understanding Rule 78 in Loans: Definition and Example

Loans, whether for personal use, mortgages, or business financing, often involve complex repayment structures. One common method for calculating loan payments and interest is known as the Rule of 78. In this article, we’ll explore what Rule 78 is and provide a TypeScript code example to help you understand how it works.

# What is Rule 78?

The Rule of 78, also known as the Sum of Digits method, is a way to determine how much of each loan payment goes towards the principal and how much goes towards the interest over the life of the loan. It’s called the Rule of 78 because it’s based on the sum of the digits of the loan term.

Here’s how it works:

- Calculate the sum of the digits in the loan term. For example, if you have a 12-month loan, the sum of the digits is 1 + 2 + 3 + … + 12, which equals 78.
- For each month of the loan, determine how much of the total interest for the loan is assigned to that month. To do this, divide the number of months remaining in the loan by the sum of the digits. For instance, in the first month of a 12-month loan, you would have 12 months remaining, and you would divide that by 78, resulting in a fraction of the total interest.
- Multiply the fraction from step 2 by the total interest for the loan to get the interest portion of the payment for that month.
- Subtract the interest portion from the total monthly payment to calculate the principal portion.
- Repeat these steps for each month until the loan is paid off.

# Code Example in React Typescript

Repository: https://github.com/ArkMind-Sdn-Bhd/loan-rule78-calculator

# Want to Connect?

This article is written by Han Sheng, Technical Lead in Arkmind, Malaysia. He has a passion for Software Design/Architecture related stuff, Computer Vision and also Edge Devices. He made several AI-based Web/Mobile Applications to help clients solving real-world problems. Feel free to read about him via his Github profile.