# LEI Number Format Rules & ISO 17442 Check Digit Validator
> Verify 20-character ISO 17442 LEI check digits, LOU prefix allocations, and entity identifiers in sub-1ms pure edge compute.

- **Canonical URL:** https://stanzaapi.com/tools/lei-validator/gleif/iso-17442-format-rules
- **Governing Standard:** ISO 17442 Legal Entity Identifier (Global Legal Entity Identifier Foundation (GLEIF))
- **Latency:** <1ms Edge
- **Privacy:** In-memory execution only (zero data stored or logged)

## Technical Overview & Governing Rules
The Legal Entity Identifier (LEI) is a 20-character alphanumeric code standardized under ISO 17442 and overseen by the Global Legal Entity Identifier Foundation (GLEIF).

Structure: Characters 1-4 represent the accredited Local Operating Unit (LOU) prefix (e.g. 5493 for Bloomberg, 2138 for London Stock Exchange, 5299 for Bundesanzeiger). Characters 5-6 are reserved (00). Characters 7-18 are the unique entity identifier assigned by the LOU. Characters 19-20 are the ISO 7064 Modulo 97-10 check digits.

Checksum Algorithm: Letters are converted to numbers where A=10 through Z=35. The entire resulting integer string is evaluated under Modulo 97: the check digits ensure that the entire 20-character sequence modulo 97 yields a remainder of exactly 1 (checksum = 1).

## Specification Matrix
| Positions | Component | Format / Example | Description & Authority |
| --- | --- | --- | --- |
| 1-4 | LOU Prefix | 5493, 2138, 5299, 3358 | Identifies GLEIF-accredited issuing Local Operating Unit |
| 5-6 | Reserved Characters | 00 | Reserved zeroes mandated by ISO 17442 for future expansion |
| 7-18 | Entity Identifier | 006MHB84DD0ZWV | Unique alphanumeric identifier assigned to the legal counterparty |
| 19-20 | Check Digits | 18 (Range 02 to 98) | Calculated via ISO 7064 MOD 97-10 algorithm for fraud prevention |

## Standard JSON Response Model
```json
{
  "lei": "5493006MHB84DD0ZWV18",
  "louPrefix": "5493",
  "louName": "Bloomberg Finance L.P.",
  "entityIdentifier": "006MHB84DD0ZWV",
  "checkDigits": "18",
  "valid": true
}
```

## Frequently Asked Questions & Edge Cases
### Q: How is the ISO 7064 MOD 97-10 check digit calculated for an LEI?
**A:** Each letter is mapped to its two-digit ASCII integer equivalent (A=10 ... Z=35). The resulting numeric string is appended with 00, divided modulo 97, and subtracted from 98. The resulting 2-digit number (02-98) forms the check digits.

### Q: Can an LEI contain special characters, spaces, or lowercase letters?
**A:** No. ISO 17442 strictly forbids lowercase letters, spaces, hyphens, and punctuation. The code must consist of exactly 20 uppercase alphanumeric ASCII characters.
