netto is a German income tax (Einkommensteuer) and social security (Sozialabgaben) calculator written in Python. It calculates net income from gross salary considering various tax brackets, social security contributions, solidarity tax (Solidaritätszuschlag), and optional church tax.
- Calculate net income from gross salary with
calc_netto() - Calculate required gross salary for desired net income with
calc_inverse_netto() - Support for tax years 2018-2025
- Married couples support (Ehegattensplitting - doubles tax brackets)
- Children support (affects nursing care insurance extra rate)
- Optional church tax (8-9%, configurable)
- Public health and pension insurance calculations
- West-German pension deduction (East German support planned)
- Type-safe configuration with Pydantic validation
- Comprehensive documentation on ReadTheDocs
Install from PyPI using pip:
pip install nettoRequires Python 3.10 or higher.
from netto import calc_netto
# Calculate net income from 50,000€ gross salary (uses defaults)
net_income = calc_netto(50000)
print(f"Net income: {net_income}€")
# Output: Net income: 30679.18€from netto import calc_netto, calc_inverse_netto, TaxConfig
# Configure for 2024, married couple, with children, no church tax
config = TaxConfig(
year=2024,
is_married=True,
has_children=True,
church_tax=0.0, # Set to 0.09 for 9% church tax
extra_health_insurance=0.014 # Additional health insurance rate
)
# Calculate net income
net = calc_netto(50000, config=config)
print(f"Net income: {net}€")
# Calculate required gross salary for desired net income
gross = calc_inverse_netto(35000, config=config)
print(f"Required gross: {gross}€")from netto import calc_netto, TaxConfig
config = TaxConfig(year=2024)
# Calculate with 2000€ deductibles and verbose output
net = calc_netto(
salary=60000,
deductibles=2000, # e.g., professional expenses
verbose=True, # Print detailed breakdown
config=config
)For more granular control, you can use the intermediate calculation functions:
from netto import calc_taxable_income, calc_deductible_social_security, get_marginal_tax_rate
salary = 50000
# Calculate deductible social security contributions
deductible_social_security = calc_deductible_social_security(salary)
# Calculate taxable income
taxable_income = calc_taxable_income(
salary=salary,
deductible_social_security=deductible_social_security
)
# Get marginal tax rate for this income level
marginal_rate = get_marginal_tax_rate(taxable_income)
print(f"Marginal tax rate: {marginal_rate:.1%}")The TaxConfig dataclass provides type-safe configuration:
| Parameter | Type | Default | Description |
|---|---|---|---|
year |
int | 2025 | Tax year (2018-2026 supported) |
is_married |
bool | False | Married status (Ehegattensplitting) |
has_children |
bool | False | Has children (affects nursing insurance) |
church_tax |
float | 0.09 | Church tax rate (0.0-0.09, set to 0.0 for none) |
extra_health_insurance |
float | 0.025 | Additional health insurance rate |
| Year | Status | Notes |
|---|---|---|
| 2018-2026 | Fully supported | Complete tax data (2026 uses 2025 estimates) |
| 2027+ | Planned | To be added |
Full documentation is available at netto.readthedocs.io.
All tax calculations are based on official German government sources:
- Tax Calculation Formulas: BMF Tarifhistorie
- Wage Tax Calculator: BMF Lohnsteuerrechner
- Social Security Deductible: Vorsorgepauschale
- Social Security Rates: Sozialversicherungsbeiträge
- Solidarity Tax: Solidaritätszuschlag
- Taxable Income Calculator: Reverse Calculator
# Clone the repository
git clone https://github.com/0-k/netto.git
cd netto
# Install in development mode with dev dependencies
pip install -e .
pip install -r requirements-dev.txt
# Set up pre-commit hooks (recommended)
pre-commit installPre-commit hooks automatically run ruff linting and formatting before each commit, preventing CI failures.
# First-time setup: install package in editable mode
pip install -e .
# Run all tests with coverage
python -m pytest --cov=netto test/
# Run specific test file
python -m pytest test/test_main.py -vNote: Use python -m pytest (not just pytest) to ensure tests run in the correct Python environment where netto is installed.
# Format code
ruff format .
# Lint code
ruff check .
# Fix linting issues automatically
ruff check --fix .cd docs/
make html
# Open docs/_build/html/index.html in your browserContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
Created and maintained by Martin Klein ([email protected]).
Repository: https://github.com/0-k/netto Documentation: https://netto.readthedocs.io/ PyPI: https://pypi.org/project/netto/
© 2025 Martin Klein