# Spain IBAN Validator & CCC Checker (Banco de España)
> Instant MOD-97 validation for 24-character Spanish IBANs with 4-digit bank code, 4-digit branch code, 2 national check digits, and 10-digit account extraction.

- **Canonical URL:** https://stanzaapi.com/tools/iban-validator/country/spain-es
- **Governing Standard:** ISO 13616 / ISO 7064 MOD-97-10 (SWIFT & ISO 13616 IBAN Registry)
- **Latency:** <1ms Edge
- **Privacy:** In-memory execution only (zero data stored or logged)

## Technical Overview & Governing Rules
In Spain, the International Bank Account Number (IBAN) has a fixed length of 24 alphanumeric characters starting with the two-letter ISO 3166-1 alpha-2 country code 'ES', followed by two MOD-97 check digits.

The National Basic Bank Account Number (BBAN) follows the official pattern: 20n. The national bank code is located at BBAN character offset [0:4]. The branch identifier is at offset [4:8].

National IBAN transfers in Spain (ES) are settled in EUR.

Validation computes the ISO 7064 Modulo-97-10 checksum by transposing the first 4 characters to the end, converting letters to numeric digits (A=10, ..., Z=35), and calculating arithmetic integer modulo 97 (must equal 1).

A Spanish IBAN is 24 characters: ES, two MOD-97 check digits, a 4-digit bank code, a 4-digit branch code, two national CCC check digits, and a 10-digit account number (structure ES2!n4!n4!n2!n10!n).

The two national CCC check digits validate the Spanish Código Cuenta Cliente (bank, branch, and account) and are separate from the ISO 7064 MOD-97 check digits that follow ES.

## Specification Matrix
| Attribute | Value | Description |
| --- | --- | --- |
| Country Code | ES | ISO 3166-1 alpha-2 |
| Total IBAN Length | 24 characters | Fixed standard length |
| BBAN Format | 20n | National structure (n=numeric, a=alpha, c=alphanumeric) |
| SEPA Zone | Yes (Single Euro Payments Area) | SEPA compliance status |
| Currency (ISO 4217) | EUR | National settlement currency |
| Bank Code Position | BBAN Offset 0 (4 chars) | National clearing code |
| Branch Code Position | BBAN Offset 4 (4 chars) | Branch identification |
| Bank Code | BBAN offset 0 (4 digits) | Spanish bank identifier |
| Branch Code | BBAN offset 4 (4 digits) | Branch (oficina) identifier |
| CCC Check Digits | BBAN offset 8 (2 digits) | National Código Cuenta Cliente control digits |

## Standard JSON Response Model
```json
{
  "valid": true,
  "iban": "ES9121000418450200051332",
  "countryCode": "ES",
  "countryName": "Spain",
  "length": 24,
  "bban": "20n",
  "sepa": true,
  "checksumValid": true,
  "bankCode": "XXXX"
}
```

## Frequently Asked Questions & Edge Cases
### Q: How many characters is an IBAN in Spain?
**A:** An official IBAN in Spain (ES) is exactly 24 characters in length. Any shorter or longer value fails ISO 13616 validation.

### Q: Is Spain part of the SEPA payment network?
**A:** Spain is a member of the Single Euro Payments Area (SEPA), enabling low-cost euro bank transfers.

### Q: What currency are Spain IBAN transfers settled in?
**A:** IBAN transfers for Spain (ES) settle in EUR, the national settlement currency. Cross-border SEPA transfers to Spain may still be denominated in EUR where both banks support the scheme.

### Q: How is the MOD-97 check digit calculated for ES IBANs?
**A:** The first 4 characters are moved to the end, letters are converted to numbers (A=10 to Z=35), and the resulting number is evaluated with modulo 97 arithmetic. A valid IBAN yields a remainder of exactly 1.

### Q: What is the CCC in a Spanish IBAN?
**A:** The CCC (Código Cuenta Cliente) is the 20-digit national account number: a 4-digit bank code, a 4-digit branch code, 2 national check digits, and a 10-digit account. In a Spanish IBAN those 20 digits follow ES and the two ISO 7064 MOD-97 check digits.
