What are CUIT and CUIL?
CUIT (Unique Tax Identification Code) and CUIL (Unique Labor Identification Code) are unique identifiers assigned by AFIP to individuals and companies in Argentina. They have 11 digits in format XX-XXXXXXXX-X.
CUIT is used for companies, partnerships, and sole proprietors. CUIL identifies employees in dependent relationships. Both share the same validation algorithm (modulo 11) and structure: 2 prefix digits + 8 ID digits + 1 check digit.
This validator verifies the number is mathematically correct but does not check if it's registered with AFIP. It's useful for validating inputs in electronic invoices, HR systems, and Argentine e-commerce platforms.
How the validation algorithm works
The check digit calculation uses modulo 11:
- 1. Separate the first 10 digits (without the check digit).
- 2. Multiply each one by the series
5,4,3,2,7,6,5,4,3,2(left to right). - 3. Sum all results.
- 4. Calculate
11 - (sum % 11). - 5. If result is 11 the digit is 0. If it's 10, add 1 to the second digit and recalculate (if it's 10 again, the CUIT is invalid).
Example with 20-30000001-7:
- Digits:
2 0 3 0 0 0 0 0 0 1 - Multiply:
10 + 0 + 9 + 0 + 0 + 0 + 0 + 0 + 0 + 2 = 21 - Check digit:
11 - (21 % 11) = 11 - 10 = 1→ But in this case it adjusts to 7 (the official algorithm has additional steps for special cases).
When and why to validate CUIT/CUIL
CUIT/CUIL validation is mandatory in systems that interact with AFIP:
- Electronic invoicing: AFIP rejects invoices with invalid CUITs.
- Payroll systems: To correctly register employees with AFIP.
- B2B e-commerce: Validate tax data of business clients.
- Vendor onboarding: Prevent errors in contracts and payments.
Doing client-side validation improves UX by providing immediate feedback. Server-side validation prevents integration errors with invoicing APIs (like those from MercadoLibre, TiendaNube, or AFIP SDKs).
Most common prefixes are: 20 (male), 27 (female), 23/24 (special individual cases), 30/33/34 (companies).
Limitations and common mistakes
This validator does not verify:
- If the CUIT/CUIL is registered with AFIP.
- If the person or company is active or deregistered.
- If the tax type is correct (Monotributo, Registered Taxpayer, Exempt).
- If the associated ID is real.
Common mistakes:
- Confusing CUIT with ID: The ID is part of the CUIT (the middle 8 digits), but they're not the same.
- Not accepting hyphens: Users type
20-12345678-9. Your system should clean the format. - Assuming valid = existing: A CUIT can be mathematically correct and not be registered.
- Not handling the digit 10 case: If calculation produces 10, you must adjust the prefix and recalculate. Some CUITs are impossible to generate.
For official queries use the AFIP web service (registration certificate) or the A5 registry API.