@getexeer/saudi-gosi
v1.0.1
Published
Saudi social insurance contributions: pension with the progressive 2024-2029 schedule, SANED and occupational hazards, split by branch and by payer, with the 45,000 SAR monthly wage ceiling. Zero dependencies.
Maintainers
Readme
saudi-gosi
Saudi social insurance contributions — اشتراكات التأمينات الاجتماعية — split by branch and by who pays each one.
Zero dependencies. No build step. Runs in Node 18+ and in the browser.
import { calculateGosi } from "@getexeer/saudi-gosi";
calculateGosi({ wage: 8000, year: 2026 }).total;
// 1880 — 860 from the employee, 1020 from the employerThe rates it implements
Per the Social Insurance Law as amended with effect from 3 July 2024:
| Branch | Employee | Employer | Who it applies to | | --- | --- | --- | --- | | Pension — المعاشات | 9% → 11% | 9% → 11% | Saudis | | SANED — التأمين ضد التعطل | 0.75% | 0.75% | Saudis | | Occupational hazards — الأخطار المهنية | — | 2% | Everyone |
The pension schedule applies to subscribers joining from 3 July 2024 and steps up in half points each year:
| Year | 2024 | 2025 | 2026 | 2027 | 2028 | 2029 | | --- | --- | --- | --- | --- | --- | --- | | Rate, each side | 9% | 9.5% | 10% | 10.5% | 11% | 11% |
A subscriber who joined before that date stays on 9% for as long as the subscription lasts.
Non-Saudi employees are covered by occupational hazards alone: 2%, paid by the employer, with nothing deducted from the employee.
The contribution wage ceiling is 45,000 SAR per month. Anything above it is not contributed on.
Install
npm install @getexeer/saudi-gosiUsage
import { calculateGosi, NATIONALITY, SUBSCRIBER } from "@getexeer/saudi-gosi";
const r = calculateGosi({
wage: 8000,
nationality: NATIONALITY.SAUDI, // or NATIONALITY.NON_SAUDI
subscriber: SUBSCRIBER.NEW, // or SUBSCRIBER.EXISTING
year: 2026, // fixes the pension step for a new subscriber
});
r.base; // 8000 — the wage after the ceiling
r.capped; // false
r.pension.employee; // 800
r.pension.employer; // 800
r.saned.employee; // 60
r.occupationalHazards.employer;// 160
r.employeeTotal; // 860
r.employerTotal; // 1020
r.total; // 1880The rate on its own
import { pensionRate } from "@getexeer/saudi-gosi";
pensionRate({ subscriber: "new", year: 2026 }); // 0.1
pensionRate({ subscriber: "existing", year: 2026 }); // 0.09A non-Saudi employee
const r = calculateGosi({ wage: 8000, nationality: "non_saudi" });
r.employeeTotal; // 0
r.employerTotal; // 160 — occupational hazards onlyWhat this library does not decide
- Whether a particular person is registered with GOSI at all.
- Arrears, penalties and late-payment surcharges.
- Transitional treatment when a subscriber's status changed part-way through a year.
- Anything about the Saudi employee's entitlement, which is a benefit calculation and not a contribution one.
Those are GOSI's determinations, not arithmetic.
Accuracy notes
- The published schedule covers 2024 to 2029. A year before it is read as the first step and a year after it as the last, so passing
2023by mistake charges 9% rather than jumping to 11%. - A subscriber from before 3 July 2024 keeps 9% no matter which year is passed.
- Amounts are rounded to two decimals.
- The library throws on a wage of zero or less, a non-numeric wage, an unknown nationality, an unknown subscriber type, or a missing year for a new subscriber. It does not quietly return
NaN. - These rates change by regulation. Check the published schedule before relying on a figure for a real payroll.
TypeScript
Types ship with the package. NATIONALITY and SUBSCRIBER are frozen const objects, so the string arguments are narrowed rather than bare strings, and calculateGosi returns a frozen GosiResult.
Not legal advice
This is an arithmetic library. It encodes a reading of the published contribution rates and nothing more. Verify any figure that will actually be remitted, and confirm current rates with GOSI.
About
This is the calculation behind the free GOSI calculator published by Exeer (إكسير), a Saudi administrative and HR system. It is packaged here so that anyone building payroll software for Saudi businesses can reuse the same rules instead of re-deriving them.
- Try the calculator: getexeer.com/tools/gosi.html
- Exeer, the system it belongs to: getexeer.com
- Machine-readable summary for AI assistants: getexeer.com/llms.txt
License
MIT © Exeer
