Filing taxes in a foreign country can seem like a daunting task, but the Spanish Tax Agency (Agencia Tributaria) provides several digital tools to make the process easier. The tax reference number is one of the most practical and quickest ways to access your tax portal. With it, you can consult your fiscal data, generate your draft, or file your income tax return via Renta WEB. In this article, we explain exactly how to obtain this code in 2026 to file your 2025 tax return, what information you need, and what to do if you encounter any issues along the way.
What exactly is the tax reference number?
The tax reference number (known in Spanish as the número de referencia) is a unique, six-character alphanumeric code issued by the Spanish Tax Agency. It acts as a temporary password, allowing taxpayers to identify themselves securely online.
If you do not have a digital certificate or are not registered with the Cl@ve system, this code is your best and most accessible option. By generating this code, you gain immediate access to your personal file. You can easily review or edit your tax return draft, submit your individual or joint return, check the status of a pending refund, and download past income certificates. It is specifically designed to simplify the annual tax campaign for everyday users, removing the need for complex digital signatures or software installations.
Step-by-Step Guide to Getting Your tax reference number
To obtain your access code, you need to visit the Spanish Tax Agency’s official website or use their official mobile app. Look for the section dedicated to the current income tax campaign and click on “Obtain your reference number” (often labeled as the RENØ service).

Step 1: Personal identification
You must first enter your Spanish identification number. The system will prompt you for your DNI (Spanish ID for citizens) or your NIE (foreigner ID number). Once entered, the portal will verify your identity and detect which access pathways are available to you.
Step 2: Provide your ID support data
Depending on the type of identification document you hold, the system requires an additional layer of security.

Step 3: Enter the famous Box 505
To generate your code for the 2025 income tax return filed in 2026, the Tax Agency requires a specific figure from your previous declaration. You must locate Box 505 (Casilla 505) from the tax return you filed in 2025 (which corresponds to the 2024 fiscal year). This box represents your general taxable base (base liquidable general sometida a gravamen).
You must type this number exactly as it appears on your previous PDF receipt. Do not use euro signs or commas as thousands separators. Only use a comma to separate the decimals (for example, 25430,50).
Step 4: Generate and save your code
Once you have entered the correct amount, click “Obtain reference”. A six-character code will appear on your screen. Save it somewhere safe. Be aware that you can generate up to ten codes per day, but only the most recently generated one will remain active.
What to Do If You Do Not Have Box 505?
A very common issue arises for expats and new residents who did not file taxes in Spain during the previous year. If you did not present a declaration for the 2024 fiscal year, you obviously will not have a Box 505 to reference.
Fortunately, the Tax Agency has an alternative verification method. When the system detects that you did not file a return last year, or if your Box 505 was exactly 0.00, it will automatically ask for your banking details instead. You will need to provide the last five digits of the IBAN of a Spanish bank account where you are listed as an official account holder. Once verified, the system will issue your tax reference number without any further complications.
Important Alternatives to Access the Tax Portal
If you are unable to generate the reference code using your ID and Box 505 or bank details, you still have excellent alternatives to access your fiscal data.
The Cl@ve PIN system is highly recommended for frequent users. It requires a one-time prior registration but allows seamless access to all government platforms. Alternatively, a Digital Certificate or an electronic DNI offers permanent, unrestricted access to the Tax Agency’s digital headquarters. Finally, if you face persistent technical difficulties, you can request an in-person appointment or phone assistance directly through the Agencia Tributaria offices.
FAQs
Can I obtain the reference code if I am filing taxes in Spain for the very first time?
Yes, you absolutely can. Since you will not have Box 505 from a previous tax return, the system will ask you to verify your identity by entering the last five digits of a Spanish bank account (IBAN) registered in your name.
Where exactly can I find the value for Box 505?
You can find this specific amount on the PDF copy of the tax return you filed last year. Look closely for the section labeled “Base liquidable general sometida a gravamen.” It is also printed on your official refund notice or payment receipt.
What happens if I generate multiple reference codes?
You are permitted to request up to ten different codes in a single day. However, generating a new code automatically revokes the previous one. Only the most recent code will grant you access to the portal.Securing your access to the Spanish tax system is the first critical step toward a smooth filing process. While the online portal is highly efficient, dealing with foreign income, deductions, and specific expat regulations can still be complex.
If you need personalized assistance, at Entre Trámites we offer management and tax advisory services for freelancers and SMEs. You can contact us through this contact form for us to call you, or if you prefer, you can schedule a free consultation or write to us on WhatsApp.



