What is a Pix key validator?
A Pix key validator is a tool that checks whether a piece of text has the format of a legitimate Pix key and identifies its type: CPF, CNPJ, email, mobile phone or random key (EVP). For CPF and CNPJ it recalculates the check digits, which rules out most typos; for phone numbers and emails it returns the normalized form that is written in field 26-01 of the BR Code. It does not query the Central Bank of Brazil (BCB) or any bank: a key with a valid format may not be registered, and only the payer's app finds that out at payment time.
The five Pix key types
| Key type | Format in the code (field 26-01) | Example |
|---|---|---|
| CPF | 11 digits, no dots or dash | 12345678909 |
| CNPJ | 14 digits, no punctuation | 11222333000181 |
| As registered, up to 77 characters | loja@exemplo.com.br | |
| Mobile phone | +55, area code and number (E.164 format) | +5511912345678 |
| Random key (EVP) | 36-character UUID generated by the bank | 123e4567-e12b-12d1-a456-426655440000 |
How the validator decides the type
- Random key: 32 hexadecimal digits separated by hyphens in the 8-4-4-4-12 pattern. It is always recognised first.
- Email: contains an
@and a dot in the domain, up to 77 characters. - Punctuated CPF and CNPJ:
000.000.000-00and00.000.000/0000-00are handled by type and have their check digits verified. - Phone: starts with +55 or 55 and has 12 or 13 digits, or has 11 digits with the area code and the leading 9 of a mobile number.
- Digits only: 11 digits with a valid check digit are a CPF; 14 digits with a valid check digit are a CNPJ; otherwise the validator reports which check failed.
Worked example: CPF check digits
Take the sample CPF 529.982.247-25. The first nine digits are multiplied by 10, 9, 8 … 2 and added up: 5×10 + 2×9 + 9×8 + 9×7 + 8×6 + 2×5 + 2×4 + 4×3 + 7×2 = 295. The remainder of 295 × 10 divided by 11 is 2, the first check digit. Repeating with ten digits and weights from 11 down to 2, the result is 5, the second digit. Since 25 matches, the validator accepts the key and shows the normalized form 52998224725, which is how it goes in the code. Change the ending to 26 and the result becomes "Invalid CPF". The CNPJ follows the same idea with weights 5,4,3,2,9,8,7,6,5,4,3,2 and then 6,5,4,3,2,9,8,7,6,5,4,3,2.
Common mistakes the validator catches
| Input | Result | Why |
|---|---|---|
529.982.247-26 | Invalid CPF | Check digits do not match (one digit swapped) |
11 1234-5678 | Not recognized | 8-digit landline; a Pix key uses a 9-digit mobile number |
nome@email | Not recognized | Domain is missing a dot |
11.222.333/0001-81 | Valid CNPJ → 11222333000181 | Punctuation removed for the code |
Fulano@Example.com | Email → fulano@example.com | Normalized to lowercase |
What to do after validating
If the key is yours, generate the code in the Pix QR code generator; the generator uses the same detection and shows the type in real time as you type. If the key belongs to someone else, start a Pix in your app with that key and check the name shown on the confirmation screen before completing; that is the only registration check that exists. To inspect a whole code instead of just the key, use the Pix decoder.
References
Key types and formats: Central Bank of Brazil (BCB), Pix and Manual de Padrões para Iniciação do Pix; CPF and CNPJ check digits per the public algorithms of the Receita Federal (modulo 11); phone numbers per ITU-T E.164; random key per RFC 4122 (UUID).