Your donation is taken from your pre-tax salary, meaning that part of your donation comes from money that would have otherwise gone to HMRC.
Making a £20 donation to charity as a 20% taxpayer:
Total donated to charity = £20
You pay = £16
Reduction in tax = £4
Making a donation as a 40% taxpayer:
Total donated to charity = £20
You pay = £12
Reduction in tax = £8