SDLT is calculated marginally — only the portion of the price within each band attracts that band's rate. The first £250,000 of an owner-occupier residential purchase is currently free of duty (£425,000 for first-time buyers). The 5%, 10%, 12% bands then apply progressively above that threshold.
If the buyer already owns another property anywhere in the world, an additional 5% applies on the WHOLE consideration. If the buyer is non-resident for SDLT purposes (broadly: not present in the UK for ≥183 days in the year prior), a further 2% applies on top.
Belgrave Estates' tax calculator gives you a precise estimate per scenario. The legal pack issued by your solicitor confirms the final number on exchange of contracts.