I build free, privacy-first web tools as Loona Automation. The newest one is a set of salary and tax calculators, and the first calculator I built — UAE end-of-service gratuity — taught me something surprising: a large share of the gratuity calculators on the web still apply a law that was abolished in 2022.
The current law (Federal Decree-Law 33/2021, Article 51)
For a full-time foreign private-sector employee with at least 1 year of continuous service:
- Daily basic wage = last monthly basic salary ÷ 30. Basic only — housing, transport and allowances do NOT count.
- First 5 years: 21 days of basic wage per year.
- Every year after the 5th: 30 days of basic wage per year.
- Part-years are pro-rated.
- Total gratuity is capped at 2 years' wage.
- The employer must pay within 14 days of the contract ending (Article 53).
Formula: Gratuity = (Basic/30 × 21 × min(years,5)) + (Basic/30 × 30 × max(years−5,0)), capped at 24 × monthly basic.
Worked example: basic salary AED 10,000, 7 years of service → (10,000/30 × 21 × 5) + (10,000/30 × 30 × 2) = 35,000 + 20,000 = AED 55,000.
What changed in February 2022
Before Decree-Law 33/2021 took effect on 2 February 2022, the UAE had limited and unlimited contracts, and resigning under an unlimited contract cut your gratuity (to 1/3 or 2/3 depending on service). That system is gone. Today all private-sector contracts are fixed-term, and resignation does NOT reduce gratuity. If a calculator asks you to pick "limited vs unlimited" or docks your gratuity for resigning, it is calculating with the old law. (Two honest exceptions: DIFC and ADGM have their own employment schemes, and some employers use the voluntary alternative savings scheme instead of gratuity.)
Why I built it client-side
Salary data is sensitive. The calculator runs 100% in the browser — no server, no sign-up, nothing leaves the device. The whole thing is a static site: one HTML file per tool with the formula in plain JavaScript, tested against hand-computed cases from the law text (my test suite checks the example above and the 2-year cap, among others).
Try it: https://loonaautomation.github.io/loona-salary-calculators/uae-gratuity-calculator/
Code and the other calculators (Saudi end-of-service, Netherlands net salary with the 30% ruling, Germany gross-to-net, Pakistan salary tax): https://github.com/loonaautomation/loona-salary-calculators
If you spot a formula edge case I have missed — especially around unpaid-leave exclusions — I would genuinely like to hear it. Accuracy is the whole point of the tool.
![Why Object.keys(user) Returns string[], Not (keyof User)[]: TypeScript Means It](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2q4w48b9bzs43tynyhsf.png)

