Tax! (UK employment variety)
Are you looking at your payslips wondering how any of those numbers
are arrived at? Why they sometimes change from month to month? Why on
earth they don't show their working? I was.
There are plenty of online salary take-home pay calculators, but they
only show figures for the whole year. They don't allow you to put in
your payslips from the start of the tax year and tell you what your
next one will be. So I wrote this.
NB: Right now, this will only work if your Tax Code ends with an L,
and if you're in National Insurance Contributions (NIC) Letter A. In
the fullness of time, I might flesh this out further to cope with more
complications. Help is welcome!
The TL;DR is:
- Create some Payslips. Payslips must start from the beginning of a
tax year (e.g. April 2025) and have no gaps. The zero value is fine
for months where you had no income. If you change job within a
month, you may have several payslips for the same month. That's ok
to put in your list of Payslips: it's fine to repeat a month, so
long as it's all in order.
- Call Complete() on them
- Print out the result
For payslips from the past, you can provide the numbers from your
actual payslips. But for all payslips, any missing values will be
calculated.
I could find no good resources on how PAYE actually works. There seems
to be nothing I could find on gov.uk or HMRC's websites. It's all very
frustrating. The following is my understanding of how it all works. It
creates numbers that match my own payslips fairly closely.
What do you pay income tax on?
The short version is salary - employee pension contributions - personal allowance.
What ever is left over is what you pay income tax on. But, income tax
and personal allowance, via PAYE (which stands for Pay As You Earn) is
all calculated on Year-to-date (YTD) figures (PAYE - the clue's in the
name).
So what you actually do is this:
- Add up your total income from the start of this tax year,
i.e. year-to-date (YTD).
- Subtract from that all your pension contributions, YTD.
- Also subtract your personal allowance, YTD.
- Figure out how much tax you should have paid on this remaining
figure, YTD (more on this later).
- Subtract from this, the amount of tax you've already paid this
year. This final number is the amount of tax to pay this month.
What's a personal allowance?
It's an amount of money you're allowed to earn on which you pay no
income tax at all. The very rough version, is if your Tax Code ends
with an L (which I think is by far the most common), remove the L, and
add a 0. The precise calculation is a bit more complex, involving
integer division into 500s, and adding 9s in various places. The code
in this library does it as correctly as I can figure out. The default
Tax Code is 1257L. This means you're allowed to earn roughly £12570
per year (the precise figure is £12579) and pay no income tax at all
on that. (Note that HMRC may actually set your personal allowance to
some other figure that seems to bear no relation whatsoever to either
the rough or precise methods for calculating personal allowance.)
But! Personal allowance is accrued 1/12th per month. So if your tax
code is the default 1257L, then you get personal allowance of £1048.25
per month. It also rolls over: if you earn less than your monthly
personal allowance in a month (e.g. less than £1048.25) then any
amount left over rolls into the next month, where it can be used.
This means that if you have a period of time in a year when you're
unemployed, then your personal allowance will build up. This is why
when you start earning again, it can take a couple of months for your
income tax to stabilise - it'll start off low because you're using up
that personal allowance that's built up.
This also means that if you are unemployed (or not using up your
personal allowance) as you move from one tax year to another
(e.g. let's say you're unemployed in February and March) then you will
have over-paid tax and you'll be able to get a refund: essentially in
those months you accrued personal allowance but were unable to use it.
Income Tax YTD
PAYE does personal allowance and income tax all based on YTD
figures. But it also scales all the tax bands YTD too.
Here are the tax bands for tax year 2024/25. "Taxable income" is
salary - pension - personal allowance, and these figures are for the
whole year.
| £0 - £37,700 | 20% | Basic rate |
| £37,701 - £125,140 | 40% | Higher rate |
| over £125,140 | 45% | Additional rate |
Let's say your net taxable income for the whole year is £50k. If PAYE
didn't scale the tax bands, then it would mean that around Christmas
time each year, your income YTD, would pass over the £37,700
threshold, and your income tax would suddenly jump up. No one wants
this. It's Christmas!
Therefore, all the tax band thresholds are scaled down YTD too. This
means that even in April, right at the start of the tax year, with
your notional £50k taxable income for this year ahead of you, you're
already paying a bit of higher-rate tax, right from month 1
(April). It means that the amount of tax you pay remains the same
throughout the year - there are no surprises if your salary remains
constant.
But, imagine instead that in April on its own, you earn £70k and then
you're unemployed for the rest of the year. Well essentially the tax
calculations will assume your salary is going to be £70k*12 = £840k,
and so in April you're going to be paying a lot of additional-rate
tax. 11 months later or so, you'll probably be able to claim back a
lot of tax as it turns out you should have never paid any tax in the
additional-rate band at all (plus, you only got to use up 1
month's-worth of your personal allowance, so you've actually over-paid
tax for two reasons).
From what I can tell, PAYE is quite cleverly designed so that:
- If you remain employed then once your income tax stabilises, it'll
then remain steady throughout the year.
- It's far more likely you over-pay tax (either by not using up your
personal allowance, or by the income tax calculations making the
assumption that your earnings YTD are a proportional scaling of
your total eventual annual income), than under-pay tax. From HMRC's
point-of-view, this is a good thing.
National Insurance Contributions
This is totally different. There is no YTD scaling stuff going on
here. If your National Insurance Contribution letter is A, then for
2024:
| £1048 - £4189 | 8% |
| over £4189 | 2% |
So you just take your current monthly income (gross! - don't do any of
the subtraction of pensions or personal allowance etc), and plug it in
to the above table and that's that.
Net income
Finally then, your net income, or take-home pay, should be more or less:
gross monthly salary - employee pension contribution - income tax - NIC tax
Note that personal allowance doesn't appear here at all - that's only
used for calculating your income tax.