CPF generator and validator
Generate valid CPFs to use in tests or check whether a CPF is valid.
A valid CPF is generated when the page opens. Choose the quantity and the format, or click "Generate CPF" to create another one.
How it works
- The CPF is generated on the server and is not stored anywhere.
- The number follows the rules of Brazil's Federal Revenue Service (Receita Federal).
- The check digits are calculated correctly.
- The number is for testing only and does not belong to any real person.
- The latest generated values are listed below the button until you leave the page.
How to use the API
You can integrate the CPF generator into your app through our REST API.
Endpoint
GET /api/generators/cpf
Query parameters
- quantity
- Optional. From 1 to 50. When set, the response has the "cpfs" list instead of "cpf".
- formatted
- Optional. "false" generates digits only. Default: "true".
curl example
curl "https://devtools.vmotta.dev/api/generators/cpf?quantity=2&formatted=false"
Response
{
"cpfs": [
"52998224725",
"11144477735"
]
}Enter a CPF and click "Validate CPF" to find out whether it is valid.
How it works
- Validation runs on the server and nothing is stored.
- The validator checks whether the CPF follows the rules of the Federal Revenue Service.
- Both the format and the check digits are verified.
- The CPF can be entered with or without punctuation (123.456.789-10 or 12345678910).
- The result shows up right below the field.
How to use the API
You can integrate the CPF validator into your app through our REST API.
Endpoint
POST /api/validators/cpf
Request body
- cpf
- Required. The number, with or without punctuation.
curl example
curl -X POST https://devtools.vmotta.dev/api/validators/cpf \
-H "Content-Type: application/json" \
-d '{"cpf":"123.456.789-10"}'Example body
{
"cpf": "123.456.789-10"
}Response
{
"isValid": false
}