RFC generator and validator

RFC generator for tests: samples with a valid check digit and the algorithm worked out.

loading RFC generator and validator
About this tool

RFC: what it is and how to test it

The RFC (Registro Federal de Contribuyentes) is the tax ID of Mexico, issued by the SAT. People have 13 characters and companies 12. Like the CURP it is built from the holder: initials, birth or incorporation date and a 3-character homoclave, and invoices (CFDI) fail when it is wrong.

For tests only. These numbers have a correct format and check digit but belong to no real person or account. Never use them to deceive, to open accounts or to bypass a check. The numbers on this page come from the same generator as the tool, with a fixed seed so that the examples do not change; the tool creates new ones at every click.

Structure of the number

Person: 4 letters, 6 digits of date (YYMMDD) and 3 of homoclave. Company: 3 letters, 6 of date and 3 of homoclave. The last homoclave character is a check digit calculated over the previous 12 positions; the generic RFC of the SAT for the public (XAXX010101000) and for foreigners (XEXX010101000) are valid although their homoclave is 000.

The check digit, step by step

The 12 positions (a company RFC has 11 before the check digit and is padded with a space on the left) take their value in the alphabet 0123456789ABCDEFGHIJKLMN&OPQRSTUVWXYZ plus space and Ñ, are multiplied by the weights 13 down to 2 and summed. The check character is 11 minus the remainder of the sum by 11, taken mod 11, as the same alphabet position: 10 is the letter A.

Worked example with SMQ 711125 TX4:

PositionCharacterValueWeightProduct
1(space)3713481
2S2912348
3M2211242
4Q2710270
577963
61188
71177
81166
922510
1055420
11T30390
12X34268

Sum = 1613; 1613 mod 11 = 7; 11 - 7 = 4, taken mod 11; the value 4 is the character "4" of the alphabet (10 is the letter A).

Valid examples

Five numbers generated by the tool with a fixed seed, each one accepted by its validator:

Example (formatted)Without maskValidator
SMQ 711125 TX4SMQ711125TX4valid
PLY 621221 FU0PLY621221FU0valid
RAPX 620420 2H0RAPX6204202H0valid
PKC 820814 M16PKC820814M16valid
SNI 111119 TW7SNI111119TW7valid

How the validator answers

The same first example, one with a changed ending and one truncated, checked by the validator:

ValueResultReason
SMQ 711125 TX4valid-
SMQ711125TX5invalidthe check digit should be 4
SMQ711125Tinvalidneeds 12 or 13 characters

Common mistakes

  • A 12-character RFC is a company, not a typo: validate the length first and pad a company RFC with a space on the left before the weighted sum.
  • Do not treat the homoclave as free text: the SAT assigns it and a validator can only check its last character.

Frequently asked questions

What is the difference between RFC and CURP?

The CURP identifies a person for civil purposes and has 18 characters; the RFC identifies a taxpayer, person or company, and has 13 or 12. A person has both and the first 10 positions of each are similar but not the same rule.

Does a valid RFC mean the taxpayer is registered?

No. The check character proves the number is well formed. To know whether an RFC is registered and active, use the SAT consultation.

Can I use a RFC number generated here in a real system?

No. A number such as SMQ 711125 TX4 has a correct format and check, but nobody was issued it, and it may coincide with a real holder by chance. Use it in test environments, demos and automated tests that never leave your control.

Report a problem