Skip to content

Decisions7 min read

End-of-service gratuity in custom HR software: what the calculation needs (not legal advice)

By Published

Short answerTo calculate UAE end-of-service gratuity, HR software needs each worker's last basic wage kept apart from allowances, start and end dates, unpaid absence days, work pattern and the rule set that applies. Article 51 of Federal Decree-Law No. 33 of 2021 gives a full-time foreign worker 21 days of basic wage for each of the first five years and 30 days for each year after, capped at two years' wage. DIFC has its own law.

Article 51, clause by clause, as software requirements

I read a law like this as a list of inputs. Each clause of Article 51 of Federal Decree-Law No. 33 of 2021 either needs a field in the database or a rule in the calculation. The wording below follows the English copy published on the UAE Government portal, which is marked as not an official translation. This is not legal advice. Confirm the current text, any later amendments and your own cases with your labour lawyer or with MOHRE, the Ministry of Human Resources and Emiratisation, before anyone signs off a calculation.

What Article 51 saysWhat the software needs
A national worker's end of service benefits follow the pensions and social security legislationA nationality field, and a rule that takes these workers out of the gratuity run
A full-time foreign worker with a year or more of continuous service is entitledWork pattern, start date, end date and a one-year threshold
21 days of wage for each of the first five years, 30 days for each year beyond that, on the basic wageTwo bands held as settings, not typed into the code
Parts of a year count in proportion, once one year is completeService length kept to the day
Unpaid days of absence are not included in the service termEvery unpaid absence stored with its dates
The last basic wage is used for monthly, weekly or daily paid workers; an average daily wage for pieceworkWage history with dates, and the pay basis on the contract
The whole benefit must not exceed two years' wageA cap check that runs after the bands
The employer may deduct amounts payable under the law or a judgmentDeductions as separate lines with a reason

Basic wage and allowances have to be separate fields

The definitions in Article 1 decide the data model. Basic wage is the wage stipulated in the employment contract, and it does not include any other allowances or benefits in kind. Wage is the basic wage plus the cash allowances and benefits in kind.

So a single salary number is not enough. I would store basic wage and each allowance as its own dated line, and never overwrite them. A raise becomes a new line with a start date. The calculation then reads the basic wage in force on the last day, and the old lines stay there to explain last year's figures.

The cap is worded as two years' wage, while the bands are worded on the basic wage. I would not let a developer decide what that difference means. Store both figures, show both on the calculation sheet, and let your lawyer confirm how the cap is applied.

Service length: two dates, and every unpaid absence

Service length looks like end date minus start date. It is not. Unpaid days of absence come out of the service term, so the leave module has to mark each absence as paid or unpaid and keep its dates. If unpaid leave lives in a spreadsheet, the gratuity figure will be wrong for exactly the people who took it.

Article 67 says periods are counted on the Gregorian calendar, with a year of 365 days and a month representing 30 days. Article 51 does not spell out how to turn a monthly basic wage into one day's wage, or how to turn leftover days into part of a year. My rule: both are settings with a name, a value and the date they were approved, agreed with your lawyer or auditor before go-live.

A worked calculation: 7 years and 3 months on a basic wage of AED 6,000

An example with made-up figures. A full-time foreign worker leaves after 7 years and 3 months of service, counted after unpaid absence has been removed. The last basic wage is AED 6,000 a month, and allowances are AED 4,000 a month on top. I have assumed one day's basic wage is the monthly figure divided by 30, which gives AED 200. That divisor is the setting to confirm.

  • The software should print this working, not only the final number. The sheet is what HR hands to the worker and to an auditor.
  • Save the result with the inputs and settings used on that day, so it can be reproduced later.
StepWorkingResult
First five years5 years x 21 days105 days
Time beyond five years2.25 years x 30 days67.5 days
Total days of basic wage105 + 67.5172.5 days
Gratuity before deductions172.5 x AED 200AED 34,500
Cap checkTwo years of basic wage is AED 144,000; two years of wage with allowances is AED 240,000Below the cap on either reading

Part-time staff, alternative schemes and DIFC

Article 51 covers full-time workers. Article 7 lists other work patterns: part time, temporary and flexible work, plus any others the Implementing Regulation adds. Article 52 leaves end of service benefits for those patterns to that regulation. I could not open the regulation on an official site while writing this, so I am not quoting its formula. For the build, it means contracted hours and work pattern are stored per contract, and the part-time rule is a separate, tested function.

Clause 8 of Article 51 lets the Cabinet approve alternative schemes to end of service benefits. If your company joins one, the software needs a join date for each worker and a way to stop accrual under the old rule from that date.

DIFC shows why the rule set has to be a field. Under the DIFC Employment Law, gratuity is owed only for service before the Qualifying Scheme Commencement Date, which is 1 February 2020 for staff already employed then. From that date the employer pays monthly into a qualifying scheme: 5.83% of monthly basic wage for the first five years of service and 8.33% for each additional year. For the old gratuity, the DIFC law sets the daily rate as basic wage divided by 365, a basic wage of no less than 50% of annual wage, and a cap of two times annual wage. Same 21 and 30 days. Different arithmetic. If you operate in another free zone, ask your lawyer which law applies before the build starts.

The gratuity data checklist for your HR scope

These are the fields and rules I would want written into the scope of any HR or payroll build that has to produce a gratuity figure.

  • Nationality, and whether the worker is covered by a pension scheme.
  • Employer entity and jurisdiction: mainland, DIFC or another free zone.
  • Work pattern and contracted hours for each contract.
  • Start date, end date, and how earlier contracts with the same employer are treated.
  • Basic wage history with dates, kept apart from every allowance.
  • Pay basis: monthly, weekly, daily or piecework.
  • Unpaid absence records with dates, taken from the leave module.
  • Settings for the two bands, the five-year boundary, the cap, the daily wage divisor and the part-year method.
  • Deductions with a reason and a reference to the law or judgment.
  • A due date for the final settlement. Article 53 gives the employer 14 days from the end of the contract to pay wages and all other entitlements.
  • A printable calculation sheet and a record of who ran it and who approved it.

Where gratuity sits in an HR system I quote

HRM and payroll software is custom work. It is not one of my fixed app packages, so I quote it separately as a fixed price after a written scope, and the checklist above is part of that scope. Hosting, third-party fees and ongoing maintenance are not included.

I build the calculation and the sheet that explains it. I do not decide what the law means. Before go-live I would ask your lawyer or auditor to sign off the settings and three or four worked cases taken from your real staff list, including one with unpaid leave and one near the five-year mark. If HR is one module of a larger ERP, I would bring it in after accounting, so the gratuity provision has a ledger to post to.

Questions

Is UAE gratuity calculated on basic salary or total salary?
Article 51 of Federal Decree-Law No. 33 of 2021 calculates the 21 and 30 day bands on the basic wage, which the law defines as excluding allowances and benefits in kind. The cap is worded as two years' wage. Confirm how the cap applies with your lawyer.
Does unpaid leave reduce gratuity?
It shortens the service term. Article 51 says unpaid days of absence are not included in the calculation of the service term, so HR software has to store each unpaid absence with its dates.
Does the same formula apply to a DIFC company?
No. DIFC has its own Employment Law. Gratuity there covers service before the Qualifying Scheme Commencement Date, 1 February 2020 for staff employed then, and after it the employer pays monthly contributions into a qualifying scheme.

Sources

Platform rules and fees in this article were checked against these official pages on 12 November 2026. They change, so confirm before you rely on them.

Sannan Malik is a software architect and product builder with 8+ years in software, CEO of Alpha Notic FZE and a Certified Scrum Product Owner. He builds mobile apps and business software for companies in the UAE, the wider Gulf, the UK, the US, Canada and Australia.

Let's build it

Got an idea? Let's talk.

The fastest way to reach me is WhatsApp. Tell me what you're building and I'll reply with how I'd approach it, which package fits, or what a custom scope would look like.

Message me on WhatsApp