Pillar: Planning and buildings
How far from a railway line can you build in Spain?
On this page
Next to a line on Spain's state rail network (the RFIG), you cannot build within 50 metres of the outer edge of the track platform. On urban land or zoned development land the general rule is 20 metres, with exceptions for land rezoned after December 2022. Any work within 70 metres (20 on urban land) also needs prior consent from the operator (ADIF on its network), which has three months to decide.


If a plot backs onto a railway, two figures shape any building plan: where the no-build line falls and whether the work sits inside the protection zone. Both come from Ley 38/2015 on the railway sector, in the wording in force since 21 December 2022, when Ley 26/2022 changed the distances on urban land.
Roads work on a similar pattern with different numbers; see the guide to building near a road.
Three strips under Ley 38/2015
On lines of the Red Ferroviaria de Interés General (RFIG, the state-run rail network) the law sets a public-domain zone, a protection zone and a no-build line (article 12). All three run along each side of the track and overlap: the no-build line falls inside the protection zone.
The outer edge of the earthworks ("arista exterior de la explanación") is where the slope of a cutting or embankment, or a retaining wall, meets natural ground. Where the ground does not allow it to be fixed, the law places it on an imaginary line three metres from the outside edge of the outer rail (article 13.3).
| Strip | Non-urban land | Urban land | What is allowed |
|---|---|---|---|
| Public domain (art. 13) | 8 m | 5 m as a general rule (8 m on land rezoned after 21.12.2022, unless the ninth transitional provision applies); the operator may reduce it after a risk assessment, never below 2 m | Only work for the railway or a public-interest service; overhead or underground crossings for private purposes by way of exception |
| No-build line (art. 15) | 50 m | 20 m as a general rule (50 m on land rezoned after 21.12.2022, unless the ninth transitional provision applies) | No building, rebuilding or extending; upkeep and maintenance of what existed when the law came into force, and the exceptions in article 15.1 |
| Protection zone (art. 14) | 70 m | 20 m | Works and uses compatible with rail traffic safety, with prior consent |
Distances in the consolidated text of Ley 38/2015 as amended by Ley 26/2022, in force since 21.12.2022. 'Urban' includes zoned development land (urbanizable delimitado, sectorizado, programado or equivalent). Rezoned land: see the section on urban land. Source: Ley 38/2015 (BOE, consolidated text). Accessed 13 November 2026.
Urban land: 20 metres and how to reduce it
On urban land or zoned development land the no-build line drops to 20 metres and the public domain to 5 (articles 13.2 and 15.2). That reduction has two linked exceptions:
- Rezoned land. If land that was rural ("no urbanizable") or unzoned development land becomes zoned development land after 21 December 2022, the reduction does not apply: the 50-metre no-build line and the 8-metre public domain stay, unless the operator sets another distance through the procedure in the law (articles 13.2, 15.2 and 15.3; Ley 26/2022, third transitional provision).
- Plans already under way. That exception does not apply where the rezoning was already part of a draft general plan or subsidiary planning rules, or an amendment or review of them, that had already received initial approval, with the required procedural steps completed, by 21 December 2022: the 20 and 5 metres then apply (Ley 38/2015, ninth transitional provision).
On top of this, the Ministry may set a no-build line below 20 metres by regulation (article 15.2), and the operator a different one for whole sections of line (article 15.3).
On request, the operator may bring the line closer at a specific spot if there is a public-interest reason, a favourable report from the planning authority and no harm to railway safety (article 15.4). On plots in consolidated urban land ("suelo urbano consolidado"), new building that keeps to the line of the neighbouring buildings may exceptionally be allowed, through the same procedure. The developer must meet the noise and vibration rules and pay to correct the effects of any future expansion of rail services.
What you can do inside the no-build line
The ban does not cover (article 15.1):
- tunnels and lines that run underground or under a slab;
- fences, enclosures and retaining walls that make the railway safer;
- non-rail transport terminals and bus, metro or tram stations that form an interchange;
- service facilities under article 42 and heavy maintenance depots for trains;
- temporary or demountable buildings without foundations, and demountable installations.
A house that was already by the line
Existing buildings may only have repair and improvement work that adds no volume, with prior consent, and the added value is ignored if the property is ever compulsorily purchased (Ley 38/2015, article 16.4). If the town plan also classes the house as fuera de ordenación (non-conforming), what that means for a purchase is explained in the guide to non-conforming buildings.
A 30 × 80 metre rural plot beside the line
The plot faces an RFIG line along its 30-metre side. We assume the outer edge of the platform and the outer edge of the earthworks both coincide with the boundary; with a cutting or embankment they do not, and a surveyor measures each one. The first 50 metres of depth (1,500 m² of 2,400) lie inside the no-build line: no house can go there. Between 50 and 70 metres (600 m²) the plot is still in the protection zone, so you can apply for consent to build there, if the town plan allows it. The last 10 metres lie outside that zone and need no railway consent, only the town hall licence. Were the same land urban, the no-build line and the protection zone would both sit at 20 metres, subject to the exceptions in the section on urban land.
Who gives consent and how long it takes
Any work, fixed or temporary installation, change of use or tree felling in the public domain or the protection zone needs the prior consent of the railway infrastructure manager (Ley 38/2015, article 16.1).
The applicant pays the cost of studying, processing and monitoring the application, and the operator may ask for a guarantee against damage to the railway (article 16.1). No amount is set: ask for a written quote. Railway consent does not replace the town hall building licence (RD 2387/2004, article 31.1). If you live abroad, a Spanish architect or a lawyer with power of attorney can file both for you; you will need your NIE (foreigner's tax number).
Why it may be refused
A refusal in the protection zone must rest on plans to widen or reroute the line within ten years, on rail traffic safety, on harm to the stability of the platform, or on the work hindering maintenance or operation (article 16.2). Before buying, ask the town hall whether a route study ("estudio informativo") is under way: once it goes to public consultation, incompatible licences in the affected area are suspended for up to a year, extendable by six months (article 7.2).
Noise and vibration
Every building, however far from the line, is subject to the noise easement zones in the noise maps or studies approved by the Ministry (Ley 38/2015, article 15.5; Ley 37/2003, article 10).
Regional networks and lines without trains
These zones apply to RFIG lines, listed in the catalogue approved by Orden FOM/710/2015 and its amendments. The law ties the zones to the line being part of the RFIG, not to trains running on it: for a disused line, check the catalogue, because a line only leaves the network by ministerial order (article 4.3).
In Catalonia, next to FGC lines being planned or built, or FMB or IFERCAT lines, you apply online to the Directorate-General for Mobility Infrastructure; next to an FGC line in service, to FGC.
Limits of this guide. This guide covers the national law and its regulation. It does not measure the platform edge on your plot or replace the operator's written answer. Regional railway laws have not been reviewed here, apart from the Catalan procedure.
If someone builds without consent
Work without consent in the public domain or protection zone is a serious offence, with a fine of €7,501 to €38,000; if it affects rail traffic safety, a very serious one, €38,001 to €380,000 (articles 106, 107 and 109). The Government Delegate can halt and seal the works; the operator then has two months to choose between demolition and regularisation (article 18). A demolition order must be carried out within a month of notice, or it is done at the owner's expense (RD 2387/2004, article 37).
What to do, in order
- Identify the line. Where: the RFIG catalogue (Orden FOM/710/2015) in the BOE. Who: you. Cost: free. Time: no time limit applies; it is a look-up.
- Ask for the planning certificate. Where: the town hall. Ask for the land class, whether the plan draws the no-build line and whether there is a noise easement. Cost: the municipal fee. Time: whatever the regional rules set; see the guide to the planning certificate.
- Commission a dimensioned plan. Who: an architect or surveyor, who locates the outer edge of the earthworks and the distances. Cost: their quote. Time: no time limit applies.
- Apply for consent. Where: the line's operator. Cost: the study and processing costs. Time: three months to decide.
- Apply for the building licence. Where: the town hall, with the railway consent. Time: whatever the regional rules set.
- Give notice before you start and finish. To: the operator, ten days ahead each time (RD 2387/2004, article 33).
- You know whether the line is RFIG or regional.
- You have a plan showing the distance from the planned house to the edge of the track.
- The planning certificate confirms the land class and, for development land, when it was rezoned: that decides whether the line is at 50 or 20 metres.
- If there is a house, you know whether it lies inside the no-build line and what work it allows.
- The arras deposit contract is conditional on railway consent if your project needs it.
Before you call an architect, you can order the plot report by its cadastral reference and arrive with the nearby roads and lines already identified.
Common questions
Can I put up a fence next to the railway?
Yes, with consent. The no-build line does not apply to fences and enclosures (Ley 38/2015, article 15.1.b), but between the public domain and that line only see-through fencing on posts without masonry footings can be approved (RD 2387/2004, article 30.2.g).
Do I need ADIF's consent to farm or plant trees?
Not to farm in the protection zone, provided irrigation water drains properly and the earthworks are not harmed; burning stubble is banned (article 16.3). Planting or felling trees in the public domain or protection zone does need consent (article 16.1).
Can I renovate a house 30 metres from the track?
On non-urban land it is inside the 50-metre no-build line: only upkeep and maintenance, plus repair and improvement adding no volume, with consent (articles 15.1 and 16.4). For upkeep, if the operator does not reply within three months and the use does not change, approval is assumed (RD 2387/2004, article 36.1). On urban land, 30 metres is outside the 20-metre line, unless the land became zoned development land after 21.12.2022 without already being in a plan with initial approval: then the 50 metres still apply (article 15.2 and ninth transitional provision).
What if ADIF does not reply?
If no decision is notified within three months of receiving the application, consent is treated as refused (RD 2387/2004, article 29.1). The exception is upkeep of an existing building inside the no-build line that does not change its use: silence then counts as approval (article 36.1).
Do these distances apply to an FGC line?
No: Ley 38/2015 only sets zones for RFIG lines (article 12). Regional lines follow their region's law; in Catalonia, through the procedure described above.
Keep reading
Check this on your own plot
Pin the plot on the map and confirm the cadastral reference: the report gathers the public data and official maps for it, each with its source and date. It does not replace the land registry extract, the notary or a tax adviser. €29 VAT included.