# Validate CPF

This is the CPF validator, just enter the CPF and click on validate CPF and it will appear if it is valid or not.

The CPF has 11 numeric digits Ex: "###.###.###-##", the CPF verification takes place using the first 9 digits and, with a simple calculation, checking if the result corresponds to the last two digits (after the "-" sign).

First multiply the first 9 digits by the decreasing sequence of numbers from 10 to 2 and add the results.

The next verification step is also simple, just multiply this result by 10 and divide by 11.

The result that really interests us is the REST of the division. If it equals the first check digit (first digit after the '-'), the first part of the validation is correct.
Important Note: If the remainder of the division is equal to 10, we consider it to be 0.
The validation of the second digit is similar to the first, but let's consider the first 9 digits, plus the first check digit, and we'll multiply these 10 numbers by the descending sequence from 11 to 2.
Following the same process as the first check, we multiply by 10 and divide by 11.
Checking the REST, as we did earlier, if the remainder matches the second check digit.