Peru RUC Generator
Generate 11-digit SUNAT RUC numbers for companies (20…) and individuals (10…) with the mod-11 check digit — synthetic test data only
For Development & Testing Purposes Only - Synthetic Mock Data
Settings
1 valueGenerates one value with a valid checksum. Press ⌘/Ctrl+Enter for a fresh one.
Generated value
No value yet
Set options, then press Generate.
Generated values are valid in shape but randomized (Test Data).
Examples
Company RUC
Company RUC · Generate20512333797A 20 prefix, eight more digits, and the mod-11 check digit 7.
Individual RUC
Individual RUC · Generate10101174102A 10 prefix plus an 8-digit DNI, closed by the check digit 2.
Wrong check digit
20512333798Invalid — check digit is 8 but the first 10 digits require 7The validator isolates the checksum failure and prints the correct digit.
About this tool
The Peru RUC Generator produces Registro Único de Contribuyentes numbers in the 11-digit form SUNAT uses. Company RUCs start with 20, while individual RUCs start with 10 followed by an 8-digit DNI and the check digit; prefixes 15 and 17 also exist for some individuals and the validator accepts them even though the generator emits 20 and 10.
The check digit is computed over the first 10 digits with weights 5, 4, 3, 2, 7, 6, 5, 4, 3 and 2. The tool calculates 11 minus the sum mod 11, then maps a result of 10 to 0 and a result of 11 to 1. Validation reports the expected digit when a pasted value fails, which makes the failing branch easy to spot in a test log.
These are synthetic values for QA and development, never for real applications, KYC checks, tax filings or identity documents; a random value can coincidentally match a real, issued number, and DevTools accepts no liability for how generated data is used. Everything runs locally in your browser.
What this tool does not do
- The tool checks the layout and check digit; it cannot confirm that SUNAT issued the RUC.
- Individual RUCs use a synthetic DNI body, not a real person's document.
- Prefixes 15 and 17 are validated but never generated, so they appear only in pasted values.
- Local validation only — nothing is sent to SUNAT or any other service.
How to use this tool
Choose the RUC type
Pick Company RUC for a 20 prefix, or Individual RUC for a 10 prefix followed by a synthetic DNI.
Generate one value
Click Generate to create one 11-digit RUC with the SUNAT mod-11 check digit appended.
Copy or validate
Copy the value or save it as .txt, or switch to Validate to check a pasted RUC and read the expected digit.
Use cases
Peruvian tax forms
Seed RUC fields on invoice and registration screens with values that pass the mod-11 check.
Prefix routing
Check that your code treats 20 as a company and 10, 15 or 17 as an individual.
Negative checksum tests
Alter the last digit of a generated RUC to exercise the rejection message in your own validator.
RUC prefixes and check digit
| Part | Rule |
|---|---|
| Length | 11 digits |
| Company prefix | 20, followed by 8 digits and the check digit |
| Individual prefix | 10, followed by an 8-digit DNI and the check digit |
| Other prefixes | 15 and 17 are accepted for some individuals but not generated |
| Check weights | 5, 4, 3, 2, 7, 6, 5, 4, 3, 2 over the first 10 digits |
| Check formula | 11 − (sum mod 11), with 10 → 0 and 11 → 1 |
Validation is local; the tool does not query SUNAT.
Common mistakes
Mistake:Treating a 10 prefix as a company
Fix:20 marks companies; 10, 15 and 17 are individual RUC patterns.
Mistake:Mapping a mod-11 result of 10 to 10
Fix:The formula maps 10 to 0 and 11 to 1 before the digit is written.
Mistake:Expecting an 8-digit RUC
Fix:A RUC has 11 digits; the 8-digit DNI is only part of an individual RUC.
Frequently asked questions
Are these real RUCs, and can I use them in production?
No. They are synthetic test values for QA and development, never for real applications, KYC checks, tax filings or identity documents; a random value can coincidentally match a real, issued number, and DevTools accepts no liability for how generated data is used.
What do the first two digits of a RUC mean?
20 marks a company. 10 marks an individual and is followed by an 8-digit DNI and the check digit; 15 and 17 also exist for some individuals and are accepted by the validator.
How is the SUNAT check digit computed?
The first 10 digits are weighted 5, 4, 3, 2, 7, 6, 5, 4, 3 and 2. The tool takes 11 minus the sum mod 11, writes 0 for a result of 10 and 1 for a result of 11.
Why does the tool reject a RUC with the wrong length?
A RUC always has 11 digits. The validator counts digits before computing anything, so a truncated or padded value fails with the length it found.
Does validation confirm the company exists?
No. It checks the prefix, length and check digit only; confirming a taxpayer requires a SUNAT lookup that this browser tool does not perform.
References & standards
Related tools
Peru DNI Generator
Generate synthetic 8-digit Peruvian DNI numbers with the RENIEC verification character in digit or letter form, and validate pasted values.
VAT Number Generator
Generate VAT numbers for EU, UK, Switzerland, Norway and global tax integration testing.
Tax Number Generator
Generate valid tax identification numbers for testing (TR, US, SG, etc.)
National Identity Generator
Generate and validate national ID numbers for testing (TR, US, DE, UK, SA, AE, QA, KW, CA, ES, BR, FR, IT, NL, SE, NO, EG, SG)
Tax ID Validator
Auto-detect and validate VAT, EIN, TIN and GST identifiers with batch checksum reporting.