Holiday when you leave a job
The only time you can be paid instead of taking statutory holiday is when you leave. Your employer must pay you for statutory holiday you've built up but not taken, even if you're dismissed. Your contract may say what happens to any extra contractual holiday.
How to work it out
Take your yearly entitlement, work out the share of your leave year you've worked up to your last day, then take away the holiday you've already used. This calculator does it day by day and rounds up to a tenth of a day, as GOV.UK's holiday entitlement calculator does. For a five-day week the statutory minimum is 28 days a year (it can include bank holidays); part-time workers get the same 5.6 weeks pro rata.
Irregular hours and part-year workers
For leave years that start on or after 1 April 2024, people with irregular hours (such as zero-hours contracts) and part-year workers build up holiday at 12.07% of the hours they work in each pay period. For these workers only, an employer can instead pay "rolled-up" holiday pay: an extra amount for holiday added to each payslip. Holiday paid that way has already been paid, so it isn't owed again when you leave.
If you've taken too much
If you've taken more holiday than you've built up, your employer can only take money back from your final pay if that was agreed in writing beforehand.