Most people working in Spain sit under standard IRPF, a progressive tax split into a state scale and a regional (autonomous community) scale that AEAT and your local community both set. This calculator uses Madrid's combined scale as the representative baseline since it runs one of the lowest regional add-ons in the country and is the most commonly cited reference point for tech salaries.
Qualifying foreign workers can apply for the Beckham Law instead, formally the Régimen Especial para Trabajadores Desplazados. Once AEAT approves it, your Spanish-source salary is taxed at a flat 24% up to €600,000 a year (47% above that) rather than the standard progressive bands, no personal allowance stacking, no regional variation, just one flat number.
Social Security sits outside whichever income-tax regime you use. Both columns in this calculator apply the same 6.50% employee contribution, capped at the base máxima de cotización, so every euro of difference you see between standard tax and Beckham Law comes purely from the income-tax line.
Eligibility for Beckham Law is genuinely restrictive: you need to not have been a Spanish tax resident in the five years before you moved, and you must apply within six months of registering with Spanish Social Security. Once approved, it runs for six tax years total, the year you arrive plus five more, then you revert to standard IRPF whether or not that suits you.