@finanzfluss/calculators
v1.2.5
Published
Financial calculators for Finanzfluss
Maintainers
Readme
@finanzfluss/calculators
A selection of financial calculators used on the Finanzfluss Website: https://www.finanzfluss.de/rechner/
🎯 Type-safe: built with TypeScript and Zod validation
🔍 Real-world tested: used by millions of Finanzfluss users
🏛️ German tax system support: Correct tax and insurance calculation
Installation
# pnpm
pnpm add -D @finanzfluss/calculators
# npm
npm install -D @finanzfluss/calculators
# yarn
yarn add -D @finanzfluss/calculatorsCalculators
Compound Interest Calculator
The Zinseszinsrechner (https://finanzfluss.de/rechner/zinseszinsrechner) demonstrates the power of compound interest for long-term wealth building. It calculates how investments grow over time when returns are reinvested, helping users visualize the compound effect on their savings.
Key Features:
- Flexible starting capital support for both lump-sum investments and zero initial capital scenarios
- Regular savings plans with configurable monthly payment amounts to model systematic investing
- Multiple compounding intervals supporting monthly, quarterly, and yearly compounding periods
- Long-term projections with duration support from short-term to multi-decade investment horizons
- Interest rate sensitivity analysis showing how small changes in returns dramatically impact final wealth
- Visual data output providing detailed breakdowns of capital growth vs. compound interest accumulation
- Realistic return modeling with validation for reasonable interest rate ranges (-10000% to 10000%)
import { compoundInterest } from '@finanzfluss/calculators'
const input = {
startCapital: 5000,
monthlyPayment: 100,
durationYears: 10,
yearlyInterest: 7,
type: 'monthly', // 'monthly', 'quarterly', or 'yearly'
}
// Validate input and calculate compound interest result
const result = compoundInterest.validateAndCalculate(input)
console.log(result.finalCapital) // Total capital after compound growth
console.log(result.totalPayments) // Sum of all payments made
console.log(result.totalInterest) // Total interest earned through compounding
console.log(result.diagramData) // Detailed growth data for visualizationSavings Calculator
The Sparrechner (https://finanzfluss.de/rechner/sparrechner) is a versatile financial planning tool that calculates any unknown variable in a savings plan when all other variables are provided. It helps users plan their savings goals by solving for end value, starting capital, interest rate, duration, or payment amount.
Key Features:
- Flexible calculation modes solving for any of five variables: end value, start capital, interest rate, duration, or payment amount
- Tax-optimized calculations supporting both distributing and accumulating investment types with capital gains tax considerations
- Partial tax exemption modeling the German partial exemption (Teilfreistellung) for funds
- Multiple saving intervals supporting both monthly and yearly payment schedules
- Visual growth tracking providing detailed capital and interest accumulation data for charts
import { savings } from '@finanzfluss/calculators'
const input = {
output: 'endValue', // What to calculate: 'endValue', 'startValue', 'yearlyInterest', 'monthlyDuration', or 'savingRate'
startValue: 10000,
savingRate: 200,
saveIntervalType: 'monthly', // 'monthly' or 'yearly'
savingType: 'inAdvance', // 'inAdvance' or 'inArrear'
yearlyInterest: 7,
interestIntervalType: 'monthly', // 'monthly', 'quarterly', or 'yearly'
yearlyDuration: 20,
considerCapitalGainsTax: true,
capitalGainsTax: 26.375,
distributionType: 'accumulating', // 'accumulating' or 'distributing'
partialExemption: 30,
useCompoundInterest: true,
}
// Validate input and calculate savings result
const result = savings.validateAndCalculate(input)
console.log(result.endValue) // Final portfolio value
console.log(result.deposits) // Total amount deposited
console.log(result.interestAfterTax) // Net interest earned after tax
console.log(result.yearlyDuration) // Duration in years
console.log(result.monthlyDuration) // Duration in months
console.log(result.diagramData) // Detailed capital and interest growth dataGross-to-Net Calculator
The Brutto-Netto-Rechner (https://finanzfluss.de/rechner/brutto-netto-rechner) calculates a net salary from gross income, accounting for all German tax and social insurance deductions. It is based on the official pseudo code for tax calculation provided by the German ministry of finance: https://www.bmf-steuerrechner.de/interface/pseudocodes.xhtml.
Key Features:
- All 6 German tax classes (I-VI) with specific calculations for single, married, and divorced individuals
- State-specific calculations for all 16 German states including varying church tax rates (8% in Bavaria/Baden-Württemberg, 9% elsewhere)
- Age-based adjustments including senior citizen tax relief (Altersentlastungsbetrag) for 64+ years
- Child allowances with support for partial children (e.g., 0.5 children for blended families)
- Flexible insurance options supporting both public (GKV) and private (PKV) health insurance
- Comprehensive social insurance including pension, unemployment, and care insurance calculations
import { grossToNet } from '@finanzfluss/calculators'
const input = {
inputAccountingYear: '2025',
inputTaxClass: 1,
inputTaxAllowance: 0,
inputChurchTax: 0,
inputState: 'Hamburg',
inputYearOfBirth: 1990,
inputChildren: 0,
inputChildTaxAllowance: 0,
inputPkvContribution: 0,
inputEmployerSubsidy: 0,
inputPensionInsurance: 0,
inputLevyOne: 0,
inputLevyTwo: 0,
inputActivateLevy: 0,
inputHealthInsurance: 0,
inputAdditionalContribution: 1.7,
inputGrossWage: 5000,
inputPeriod: 2, // 2 = monthly, 1 = yearly
}
// Validate input and calculate gross to net result
const result = grossToNet.validateAndCalculate(input)
console.log(result.outputResNetWageMonth) // Net monthly wage
console.log(result.outputResNetWageYear) // Net yearly wageNet Policy Calculator
The Rentenversicherung-Rechner (https://finanzfluss.de/rechner/rentenversicherung) compares ETF-based pension insurance policies (Nettopolice) with traditional ETF savings plans for retirement planning.
Key Features:
- ETF pension insurance analysis comparing net policies vs. direct ETF investments
- Tax optimization calculations including different taxation rules for insurance vs. investment gains
- Cost structure analysis factoring in management fees, placement commissions, and ongoing charges
- Long-term projections with realistic return assumptions (typically 7% for diversified equity portfolios)
- Flexible withdrawal scenarios supporting both lump-sum and gradual withdrawal strategies
- Real-world cost modeling using actual insurance product data and fee structures
import { netPolicy } from '@finanzfluss/calculators'
const input = {
// General inputs
savingRate: 250,
duration: 35, // in years
taxAllowance: 1000,
additionalIncome: 0,
capitalGainsTax: 26.375,
// Policy inputs
placementCommission: 299,
savingRateCosts: 4,
balanceCosts: 0.22,
fixedCosts: 10,
minimumCosts: 30,
// ETF inputs
ter: 0.2,
expectedInterest: 7,
partialExemption: 30,
// Reallocation inputs
reallocationOccurrence: 10,
reallocationRate: 40,
}
// Validate input and calculate net policy result
const result = netPolicy.validateAndCalculate(input)
console.log(result.tableData.netWorth) // Projected net worth over timeTesting
Run the test suite:
pnpm testRun type checking:
pnpm test:typesRun tests with coverage report:
pnpm test:coverageLicense
AGPL-3.0 License © 2025-PRESENT Finflow GmbH
