Canada: where the payroll formula stops and the T1 begins
Every Canadian employer withholds tax with the CRA's payroll formula, which knows only your pay and the claims on your Form TD1. It assumes the basic personal amount, your CPP and EI contributions and the Canada employment amount, and nothing else. The T1 return you file by 30 April settles the year against everything the formula could not see, and that is where a refund comes from.
The first is the RRSP deduction. A contribution you make yourself, outside payroll, comes off net income on line 20800, so it saves tax at your federal and provincial marginal rates together. Medical expenses count above the lesser of 3% of net income and a dollar threshold, charitable gifts earn a credit at the lowest rate on the first $200 and a much higher rate on the rest, and the year's tuition is claimed only as far as your tax needs it, with the remainder carried forward. Most credits are worked twice, once on the federal return and once on your province's Form 428 at its own rates and thresholds.
A second source is two employers in one year. Each one deducts CPP and EI as if it were your only job, so together they can take more than the year's maximum. Schedule 8 and Form T2204 refund the excess as a payment on the return. The same situation often costs tax, though: each employer also gives you the basic personal amount, so the income tax deducted falls short.
Ontario adds its own steps after the credits: a surtax on higher provincial tax, a tax reduction that grows with each dependant, the LIFT credit for lower incomes, and the health premium, which nothing reduces. In Quebec the provincial return is a separate TP-1 filed with Revenu Québec, so only the federal return is estimated here, with the 16.5% abatement paid back as a refundable credit.
Employment income of $68,000, with the $10,929.38 the payroll formula withheld for the year.
A $5,000 RRSP contribution made outside payroll lowers net income from $67,355 to $62,355.
Federal tax falls by 20.5% of $5,000 and Ontario tax by 9.15%, because the income stays inside the same brackets and the same health premium band.
Tax after credits: $9,446.88.
Refund: $1,482.50, which is 29.65% of the contribution.