Updated 2017-10-09 21:35:30 by AMG

Richard Suchenwirth 2017-10-07 - Below is the formula how German income tax is calculated for 2017, translated from the Excel macro given on https://de.wikipedia.org/wiki/Einkommensteuer_(Deutschland)#Tarif_2017 .

Note that the argument "e" stands for "taxable income" ("zu versteuerndes Einkommen", zvE), which is the gross income minus deductions for

  • pension insurance fees (partly)
  • health insurance fees (partly)
  • healthcare insurance
  • church tax, donations, etc.

The rules for deductions are not implemented, neither is "progression reservation" ("Progressionsvorbehalt").

I tested the code with corner values, and it looked plausible - but use it at your own risk...
 proc de_ESt_2017 e {
    if {$e > 256303} { #zone 5
        set res [expr $e*0.45 - 16164.73]
    } elseif {$e > 54057} { #zone 4
        set res [expr $e*0.42 - 8475.44]
    } elseif {$e > 13769} { #zone 3
        set tmp [expr $e-13769]
        set res [expr $tmp*($tmp*0.0000022376+0.2397) + 939.57]
    } elseif {$e > 8820} { #zone 2
        set tmp [expr $e-8820]
        set res [expr $tmp*($tmp*0.0000100727+0.14)]
    } else {set res 0.00} ;#zone 1
    return $res
 }

AMG: I highly recommend to brace your expr-essions for performance, correctness, and security reasons.