Sabbatical in Spain as a software engineer
Spain gives engineers something rare: a digital nomad visa that unlocks a 24% flat tax on salary. It also has a legal right to unpaid leave that most people have never heard of. Which of the two you use depends on whether you are leaving your job or taking it with you.
You write software, you could keep a remote contract or consulting income running, and you are weighing Barcelona or Valencia for six to twelve months. You want to know what the Beckham Law does and does not cover, and what happens to your stock.
Keep the contract: digital nomad visa plus Beckham Law
If you keep a remote job or clients outside Spain, the digital nomad visa is the route. You need €2,849 a month in 2026, at least three months of history with your employer or clients, and the foreign company must be at least a year old. No more than 20% of your income may come from Spanish clients. Holders can opt into the Beckham Law: 24% flat on employment income up to €600,000 for six years, and 47% above that. Two things blog posts get wrong. First, the 24% applies to all your employment income, wherever it is earned or paid; it is not a rate only on Spanish salary. Second, foreign dividends, interest and capital gains stay outside Spanish tax under the regime, but Spanish wealth tax still applies to Spanish assets, and you still file the foreign-asset form if you leave the regime.
Leave the job: excedencia voluntaria
If you work for a Spanish employer, or an EU employer with a Spanish entity, you have a legal right to excedencia voluntaria after one year of service: unpaid leave of four months to five years. It gives a preferential right to return when a vacancy in your category opens, not a reserved post, so agree the return in writing. During excedencia nothing is paid into Seguridad Social and no benefit rights build up, but healthcare access continues. For an engineer at a Spanish scale-up this is often better than resigning: your options keep vesting only if the plan allows it, so read the plan before you decide.
Equity and the residency date
Spain taxes residents on worldwide income, including gains on shares, at 19% to 30% on the savings scale (the top band starts above €300,000 since 2025). Under Beckham, gains on foreign shares are outside Spanish tax; without it, they are inside. So an engineer selling a large RSU position should either sell before becoming Spanish tax resident, or make sure the Beckham election is in place first. The election has to be requested within six months of registering with social security, and it cannot be fixed afterwards.
Cost and the city choice
Valencia rents rose about 15% in 2024, among the fastest in Spain, and Barcelona and Madrid remain the expensive end; the full Spain guide has current ranges per city. Day to day, Spain is cheap where it counts: a €14 set lunch, €2 to 3 beers, and groceries of €150 to 250 a month. A comfortable engineer's budget in Valencia is €1,800 to 2,300 a month; in Barcelona add €500. The calculator below recalculates your runway for each, and the risk score will flag it if your stock position is doing all the work.