Getting Started
Dependent worker payroll calculations. For self-employed, see independent worker docs.
Installation
npm install saldo
# or
pnpm add saldoQuick Start (CLI)
You can run calculations directly from the terminal if you install the package globally:
saldo dependent --year 2025 --income 1500 --twelfths 2Quick Start (Library)
Interactive Example
Understanding the Result
interface DependentWorkerResult {
yearly: {
totalGrossIncomeAmount: number; // Annual gross income
totalNetIncomeAmount: number; // Annual net income
totalLunchAllowanceGrossAmount: number; // Annual lunch allowance
};
socialSecurityContributionRate: number; // SS rate applied
monthlyBreakdown: MonthlyBreakdownResult[]; // 12 entries, one per month
}
interface MonthlyBreakdownResult {
month: MonthName; // e.g. "january"
period: PeriodT; // e.g. "2025-01-01_2025-07-31"
grossIncome: {
baseSalaryAmount: number;
baseSalaryAndLunchAllowanceAmount: number;
totalWithLunchAllowanceAndSubsidyTwelfthsAmount: number;
};
irsWithholdingTax: {
totalAmount: number;
fromBaseSalaryAmount: number;
fromLunchAllowanceAmount: number;
fromSubsidyTwelfthsAmount: number;
};
socialSecurityContribution: {
totalAmount: number;
fromBaseSalaryAmount: number;
fromLunchAllowanceAmount: number;
fromSubsidyTwelfthsAmount: number;
};
netIncome: {
totalAmount: number; // Monthly net salary (the main figure)
fromBaseSalaryAmount: number;
fromLunchAllowanceAmount: number;
fromSubsidyTwelfthsAmount: number;
};
lunchAllowance: LunchAllowanceAmountBreakdown;
subsidyTwelfths: SubsidyTwelfthsAmountBreakdown;
bracket: BracketResult;
taxRetentionTable: TaxRetentionTableResult;
}Key Parameters
year: Tax year — required (e.g.2025)income: Monthly gross income in eurosmarried/numberOfHolders: Required together for married workers (1 or 2)disabled,partnerDisabled,numberOfDependents,numberOfDependentsDisabledlocation:'continent' | 'azores' | 'madeira'(default'continent')socialSecurityContributionRate: Default0.11twelfths:Twelfths.NONE | ONE_HALF_MONTH | ONE_MONTH | TWO_MONTHS(defaultTWO_MONTHS)lunchAllowanceDailyValue,lunchAllowanceMode("cupon"or"salary"),lunchAllowanceDaysCountincludeLunchAllowanceInJune: Whether June gets lunch allowance (defaultfalse)oneHalfMonthTwelfthsLumpSumMonth:"june"or"december"(default"december")isencaoHorarioMonthly: Monthly “isenção de horário” supplement (Art. 218.º–219.º + 265.º CT). Default0benefitsOfYouthIrs+yearOfYouthIrs: IRS Jovem partial monthly retention exemption (Art. 2.º-C CIRS). See the IRS Jovem section in the API reference
Common Scenarios
Single Person
Interactive Example
Married with Children
Interactive Example
Disabled Worker
Interactive Example
With Lunch Allowance
Interactive Example
Using Twelfths Enum
Interactive Example
Working with Types
import {
simulateDependentWorker,
LocationT,
Twelfths,
DependentWorkerResult,
SimulateDependentWorkerOptions
} from 'saldo';
// Type-safe dependent worker calculation
const dependentOpts: SimulateDependentWorkerOptions = {
year: 2025,
income: 1500,
location: 'continent',
};
const dependentResult: DependentWorkerResult = simulateDependentWorker(dependentOpts);Regional Differences
Each Portuguese region has different tax rates:
Interactive Example
Error Handling
The library provides clear error messages for invalid configurations:
Interactive Example
Next Steps
- Learn about tax situations and scenarios
- Explore the tax tables explorer
- Understand lunch allowances
- Review the dependent worker API
- Browse dependent worker examples
- Working with self-employed? Jump to the independent worker docs.
Last updated on