The formula for calculating gratuity is very simple, Total gratuity = (last basic monthly salary) X (15/26) X (years of job). For example, you started the job in 2019 and resigned in 2024.