How a UK tax code is derived from a taxpayer's allowances, and what 1257L, BR, D0 and K codes mean in practice.
Primary source: Tax codes (GOV.UK).
A tax code tells an employer how much tax-free pay an employee is entitled to across the year. The number in the code is the allowance divided by ten, so 1257L corresponds to an allowance of £12,570. The letter that follows says how that allowance should be applied.
The code is recalculated whenever the information behind it changes — a change of job, a new benefit in kind, untaxed income such as savings interest, or a correction to an earlier year — and the employer applies the new code from the next payroll run.
The 1257L code is the standard code for a taxpayer with the full Personal Allowance and one employment. A BR code taxes all of the pay at the basic rate, which is used where the allowance is already being used elsewhere. A D0 code taxes all of the pay at the higher rate, and a K code adds untaxed income to the taxable amount rather than giving an allowance.