API Reference
Dependent worker APIs for Portuguese payroll. For self-employed calculations, see the independent worker API.
Main Function
simulateDependentWorker(options)
Calculates Portuguese dependent worker taxes and net salary using the official retention tables. Returns a full 12-month breakdown, applying the correct tax period per month.
Parameters
interface SimulateDependentWorkerOptions {
year: number;
income: number;
married?: boolean;
disabled?: boolean;
partnerDisabled?: boolean;
location?: LocationT;
numberOfHolders?: number | null;
numberOfDependents?: number | null;
numberOfDependentsDisabled?: number | null;
socialSecurityContributionRate?: number;
twelfths?: Twelfths;
lunchAllowanceDailyValue?: number;
lunchAllowanceMode?: "cupon" | "salary";
lunchAllowanceDaysCount?: number;
includeLunchAllowanceInJune?: boolean;
oneHalfMonthTwelfthsLumpSumMonth?: "june" | "december";
isencaoHorarioMonthly?: number;
benefitsOfYouthIrs?: boolean;
yearOfYouthIrs?: number;
}| Parameter | Type | Default | Description |
|---|---|---|---|
year | number | Required | Tax year (e.g. 2025) |
income | number | Required | Monthly gross income in euros |
married | boolean | false | Whether the person is married |
disabled | boolean | false | Whether the person has a disability |
partnerDisabled | boolean | false | Whether the spouse has a disability |
location | LocationT | 'continent' | Tax region: 'continent', 'azores', or 'madeira' |
numberOfHolders | number | null | null | Number of income holders in marriage (1 or 2) |
numberOfDependents | number | null | null | Number of dependents |
numberOfDependentsDisabled | number | null | null | Number of dependents with disabilities |
socialSecurityContributionRate | number | 0.11 | Social security contribution rate (11%) |
twelfths | Twelfths | Twelfths.TWO_MONTHS | Holiday allowance distribution |
lunchAllowanceDailyValue | number | 10.2 | Daily lunch allowance amount in euros |
lunchAllowanceMode | "cupon" | "salary" | "cupon" | Type of lunch allowance |
lunchAllowanceDaysCount | number | 22 | Working days per month for lunch allowance |
includeLunchAllowanceInJune | boolean | false | Whether June includes lunch allowance |
oneHalfMonthTwelfthsLumpSumMonth | "june" | "december" | "december" | Month for the ONE_HALF_MONTH lump sum payment |
isencaoHorarioMonthly | number | 0 | Monthly “isenção de horário” supplement (Art. 218.º–219.º + 265.º CT). Counts in subsídio de férias but not in subsídio de Natal |
benefitsOfYouthIrs | boolean | false | Apply IRS Jovem partial monthly retention exemption (Art. 2.º-C CIRS) |
yearOfYouthIrs | number | 1 | Year of benefit (1–10 from 2025 onwards, 1–5 for 2023/2024) |
Return Value
interface DependentWorkerResult {
yearly: YearlyDependentWorkerSummary;
socialSecurityContributionRate: number;
monthlyBreakdown: MonthlyBreakdownResult[];
}
interface YearlyDependentWorkerSummary {
totalGrossIncomeAmount: number; // Total gross income for the year
totalNetIncomeAmount: number; // Total net income for the year
totalLunchAllowanceGrossAmount: number; // Total gross lunch allowance for the year
}
interface MonthlyBreakdownResult {
month: MonthName;
period: PeriodT;
taxableIncomeForIrsCalculation: number;
incomeSubjectToIrsAndSocialSecurity: number;
grossIncome: GrossIncomeAmountBreakdown;
irsWithholdingTax: IncomeComponentAmountBreakdown;
socialSecurityContribution: IncomeComponentAmountBreakdown;
netIncome: IncomeComponentAmountBreakdown;
lunchAllowance: LunchAllowanceAmountBreakdown;
subsidyTwelfths: SubsidyTwelfthsAmountBreakdown;
bracket: BracketResult;
taxRetentionTable: TaxRetentionTableResult;
youthIrs: YouthIrsBreakdown;
}
interface YouthIrsBreakdown {
applied: boolean; // true when IRS Jovem reduces this month's retention
yearOfBenefit: number; // resolved year of benefit (1–10)
exemptionPercentage: number; // 0–1, e.g. 0.75 for 2.º–4.º year in 2025+
monthlyExemptCap: number; // (multiplier × IAS) / 14 in euros
exemptIncome: number; // amount exempted this month, after the cap
}| Property | Type | Description |
|---|---|---|
yearly.totalGrossIncomeAmount | number | Annual gross income (14 months + lunch allowance) |
yearly.totalNetIncomeAmount | number | Annual net income |
yearly.totalLunchAllowanceGrossAmount | number | Annual gross lunch allowance |
socialSecurityContributionRate | number | Social security contribution rate applied |
monthlyBreakdown | MonthlyBreakdownResult[] | Array of 12 monthly breakdowns |
monthlyBreakdown[n].grossIncome.baseSalaryAmount | number | Monthly base salary |
monthlyBreakdown[n].grossIncome.totalWithLunchAllowanceAndSubsidyTwelfthsAmount | number | Total monthly gross including allowances |
monthlyBreakdown[n].irsWithholdingTax.totalAmount | number | Total IRS withheld that month |
monthlyBreakdown[n].socialSecurityContribution.totalAmount | number | Total SS contribution that month |
monthlyBreakdown[n].netIncome.totalAmount | number | Total monthly net income |
monthlyBreakdown[n].lunchAllowance.grossAmount | number | Gross lunch allowance for the month |
monthlyBreakdown[n].lunchAllowance.taxableAmount | number | Taxable portion of lunch allowance |
monthlyBreakdown[n].lunchAllowance.taxExemptAmount | number | Tax-exempt portion of lunch allowance |
monthlyBreakdown[n].subsidyTwelfths.distributedMonthlyAmount | number | Monthly distributed twelfths |
monthlyBreakdown[n].subsidyTwelfths.lumpSumAmount | number | Lump-sum twelfths for this month |
monthlyBreakdown[n].bracket | BracketResult | Tax bracket information |
monthlyBreakdown[n].taxRetentionTable | TaxRetentionTableResult | Complete tax retention table data |
monthlyBreakdown[n].youthIrs.applied | boolean | true when IRS Jovem reduces this month’s retention |
monthlyBreakdown[n].youthIrs.exemptionPercentage | number | Exemption percentage for the resolved year of benefit (0–1) |
monthlyBreakdown[n].youthIrs.monthlyExemptCap | number | Per-payment cap = (multiplier × IAS) / 14 |
monthlyBreakdown[n].youthIrs.exemptIncome | number | Exempt portion of this month’s remuneration (after cap) |
Example
Types and Enums
LocationT
type LocationT = "continent" | "azores" | "madeira";Twelfths
enum Twelfths {
NONE = 0, // No holiday allowances
ONE_HALF_MONTH = 0.5, // 1x50% - One allowance at 50% (half month)
ONE_MONTH = 1, // 2x50% - Two allowances at 50% each (one month total)
TWO_MONTHS = 2 // 2x100% - Two allowances at 100% each (two months total)
}GrossIncomeAmountBreakdown
interface GrossIncomeAmountBreakdown {
baseSalaryAmount: number;
baseSalaryAndLunchAllowanceAmount: number;
totalWithLunchAllowanceAndSubsidyTwelfthsAmount: number;
}IncomeComponentAmountBreakdown
Used for irsWithholdingTax, socialSecurityContribution, and netIncome:
interface IncomeComponentAmountBreakdown {
totalAmount: number;
fromBaseSalaryAmount: number;
fromLunchAllowanceAmount: number;
fromSubsidyTwelfthsAmount: number;
}LunchAllowanceAmountBreakdown
interface LunchAllowanceAmountBreakdown {
grossAmount: number;
taxableAmount: number;
taxExemptAmount: number;
isPaidInThisMonth: boolean;
}Tax Rules:
- Meal vouchers (
"cupon"): Tax-free up to €10.20/day - Cash allowance (
"salary"): Tax-free up to €6.00/day
SubsidyTwelfthsAmountBreakdown
interface SubsidyTwelfthsAmountBreakdown {
distributedMonthlyAmount: number; // Monthly distributed portion
lumpSumAmount: number; // Lump-sum payment in June/December
totalAmount: number; // distributedMonthlyAmount + lumpSumAmount
}SituationCodesT
type SituationCodesT =
| "TABLE1_SINGLE_OR_MARRIED_2_HOLDERS" // Single or married with 2 holders
| "TABLE2_SINGLE_ONE_OR_MORE_DEPENDENTS" // Single with dependents
| "TABLE3_MARRIED_1_HOLDER" // Married, single holder
| "TABLE4_SINGLE_OR_MARRIED_2_HOLDERS_NO_DEPENDENTS_PERSON_WITH_DISABILITY" // Single or married 2 holders + disability
| "TABLE5_SINGLE_ONE_OR_MORE_DEPENDENTS_PERSON_WITH_DISABILITY" // Single with dependents + disability
| "TABLE6_MARRIED_2_HOLDERS_ONE_OR_MORE_DEPENDENTS_PERSON_WITH_DISABILITY" // Married 2 holders with dependents + disability
| "TABLE7_MARRIED_1_HOLDER_PERSON_WITH_DISABILITY"; // Married single holder + disabilitySituation
interface Situation {
code: SituationCodesT;
description: string;
conditions: Condition[];
}Condition
interface Condition {
married: boolean;
dependents: boolean;
disabled: boolean;
partnerDisabled: boolean;
description: string;
numberOfHolders?: number | null;
}BracketResult
interface BracketResult {
signal: "max" | "min";
limit: number;
max_marginal_rate: number;
deduction: number;
var1_deduction: number;
var2_deduction: number;
dependent_aditional_deduction: number;
effective_mensal_rate: number;
}TaxRetentionTableResult
interface TaxRetentionTableResult {
situation: string;
description: string;
brackets: BracketResult[];
dependent_disabled_addition_deduction?: number;
}Utility Functions
SituationUtils.getSituation()
SituationUtils.getSituation(
married: boolean,
disabled: boolean,
partnerDisabled: boolean,
numberOfHolders?: number | null,
numberOfDependents?: number
): Situation | undefinedDetermines the appropriate tax situation based on personal circumstances.
SituationUtils.getSituationFromCode()
SituationUtils.getSituationFromCode(code: string): Situation | undefinedRetrieves a tax situation by its code.
Validation Functions
The library includes internal validation functions called automatically:
validateNumberOfHolders(numberOfHolders)validateMarriedAndNumberOfHolders(married, numberOfHolders)validatePartnerDisabled(married, partnerDisabled)validateDependents(numberOfDependents, numberOfDependentsDisabled)validateLunchAllowanceMode(lunchAllowanceMode)validateYear(year)validateYouthIrsForDependentWorker(benefitsOfYouthIrs, yearOfYouthIrs, year)
Error Handling
Advanced Usage
Disability Benefits
IRS Jovem (Youth IRS)
Partial monthly IRS retention exemption for young workers. Bracket lookup uses
the full monthly remuneration; the resulting effective rate is then applied
only to the non-exempt portion. The exempt amount per payment is capped at
(multiplier × IAS) / 14.
Year-of-benefit table (2025 onwards, per Lei n.º 45-A/2024 — Orçamento do Estado para 2025):
| Year of benefit | Exemption | IAS multiplier (annual cap) |
|---|---|---|
| 1.º | 100 % | 55 × IAS |
| 2.º – 4.º | 75 % | 55 × IAS |
| 5.º – 7.º | 50 % | 55 × IAS |
| 8.º – 10.º | 25 % | 55 × IAS |
For 2023 and 2024 the regime is narrower (5 years, lower percentages) — see
youth-irs-data.ts.
Legal references:
- Art. 2.º-C do Código do IRS (CIRS) — defines the partial exemption for young workers.
- Despacho n.º 9971-A/2024, alínea g) do n.º 7 — instructs employers to apply the bracket of the full remuneration but charge retention only on the non-exempt part.
- Lei n.º 45-A/2024 (Orçamento do Estado para 2025) — extends the regime to 10 years and sets the 55 × IAS annual cap.
- Lei n.º 13/2023 — original Youth IRS regime (5 years).