The EMI formula compounds your loan amount monthly at the agreed interest rate, then divides it across your tenure so each payment is equal.
EMI = P × r × (1+r)n / ((1+r)n − 1)
P is the principal (loan amount), r is the monthly interest rate (annual rate ÷ 12 ÷ 100), and n is the number of monthly instalments.
In the early years of a loan, most of your EMI goes toward interest. As the principal reduces, more of each EMI starts paying down the loan itself. This is why prepayments in year 1 save you far more than prepayments in year 10.