DevTools Logo

Peru RUC Generator

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

Runs in your browser

For Development & Testing Purposes Only - Synthetic Mock Data

Settings

1 value

Generates 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).

Legal Disclaimer: Generated data is for software testing and validation purposes only (e.g. verifying input masks, form validation, or database seeding). It is randomly generated and not taken from any real record, but a random value can coincidentally match a real, issued number, so never use it in real applications, payments, KYC or official forms. Using it to impersonate real people or for any fraudulent activity is illegal. DevTools accepts no liability for how generated data is used.

    Examples

    Company RUC

    Input
    Company RUC · Generate
    Output
    20512333797

    A 20 prefix, eight more digits, and the mod-11 check digit 7.

    Individual RUC

    Input
    Individual RUC · Generate
    Output
    10101174102

    A 10 prefix plus an 8-digit DNI, closed by the check digit 2.

    Wrong check digit

    Input
    20512333798
    Output
    Invalid — check digit is 8 but the first 10 digits require 7

    The 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

    1. Choose the RUC type

      Pick Company RUC for a 20 prefix, or Individual RUC for a 10 prefix followed by a synthetic DNI.

    2. Generate one value

      Click Generate to create one 11-digit RUC with the SUNAT mod-11 check digit appended.

    3. 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

    PartRule
    Length11 digits
    Company prefix20, followed by 8 digits and the check digit
    Individual prefix10, followed by an 8-digit DNI and the check digit
    Other prefixes15 and 17 are accepted for some individuals but not generated
    Check weights5, 4, 3, 2, 7, 6, 5, 4, 3, 2 over the first 10 digits
    Check formula11 − (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