Me On IT
Published on

The Swiss Tax System for Developers, Part Two

Authors

In the first part, it was about the Swiss Federal Tax. Now it's about the Cantonal Tax and the Municipal Tax.

In this context, there is often talk of the tax rate. This is a relative value that differs from canton to canton and from municipality to municipality. But equally important is the absolute value to which this tax rate refers. However, this absolute value also varies from canton to canton.

It's the simple state tax 🥵.

I finally found the numbers for the simple state tax in the Cantonal Sheets. If we take the values for 2023 from the cantonal sheet for the canton of Zurich, we can write:

const basicRate = [
        [0,  6700], // 0% for the first 6700
        [2,  4700], // 2% for the next 4700
        [3,  4700], // Same as above
        [4,  7600], // Same as above
        [5,  9300], // Same as above
        [6, 10700], // Same as above
        [7, 12400], // Same as above
        [8, 16900], // Same as above
        [9, 32500], // Same as above
        [10,32200], // Same as above
        [11,51000], // Same as above
        [12,66200], // Same as above
        [13,254900] // 13% for income parts over 254,900 CHF
    ]

For calculating the simple tax, we then write this simple function:

function calculateStateTaxZurich(income, basicRate) {
        return basicRate.reduce(([tax, remainder], [percent, amount]) => {
            let taxable = Math.min(amount, remainder);
            return [tax + taxable * (percent / 100), remainder - taxable];
        }, [0, income])[0];
    }

(Here, the basic rate is quite elegantly iterated over with reduce and a function literal to "collect" the tax burden. 😉)

However, for the calculation of the cantonal tax, there is also a calendar year-dependent tax rate. In our case, for the canton of Zurich and the year 2023, that's exactly 99% of the simple state tax.

We correct our calculation as follows:

function calculateStateTax23Zurich(income, basicRate, taxRate) {
       const stateTax = calculateStateTaxZurich(income, basicRate);
        return stateTax * (taxRate / 100);
    }

Now only the municipal tax with its associated tax rate remains. It gets simpler! We note:

function calculateMunicipalTax(income, basicRate, taxRate) {
       const stateTax = this.calculateStateTax(income, basicRate);
        return stateTax * (taxRate / 100);
    }

-- However, finding out the tax rate for your own municipality is something we deliberately leave to the reader 😛.