KE1.be / CPF Validator

Enter a CPF number and click Validate


How to validate a CPF?

The CPF is formed by 11 digits, and the verification of the CPF is carried out from the first 9 digits

Example CPF 111.333.666-XX

1) Calculate the first digit

To calculate take the 9 first digit we will use the formula below:

T = d0x10 + d1x9 + d2x8 + d3x7 + d4x6 + d5x5 + d6x4 + d7x3 + d8x2
X = Quotient(T / 11)
Y = Rest(T / 11)
  1. If Y is less than 2, then the digit is equal to 0
  2. If Y is greater than or equal to 2, then the digit is equal to (11 - Y)

Result:

T = 1x10 + 1x9 + 1x8 + 3x7 + 3x6 + 3x5 + 6x4 + 6x3 + 6x2
T = 10 + 9 + 8 + 21 + 18 + 15 + 24 + 18 + 12
T = 135
X = Quotient(135 / 11)
X = 12
Y = Rest(135 / 11)
Y = 3

Since Y is greater than or equal to 2 we will apply rule 2

First Check Digit = 11 - 3
First Check Digit = 8

2) Calculate the second digit

To calculate take the 9 first digit plus the first check digit we will use the formula below:

T = d0x11 + d1x10 + d2x9 + d3x8 + d4x7 + d5x6 + d6x5 + d7x4 + d8x3 + d9x2
X = Quotient(T / 11)
Y = Rest(T / 11)
  1. If Y is less than 2, then the digit is equal to 0
  2. If Y is greater than or equal to 2, then the digit is equal to (11 - Y)

Result:

T = 1x11 + 1x10 + 1x9 + 3x8 + 3x7 + 3x6 + 6x5 + 6x4 + 6x3 + 8x2
T = 11 + 10 + 9 + 24 + 21 + 18 + 30 + 24 + 18 + 16
T = 181
X = Quotient(181 / 11)
X = 16
Y = Rest(181 / 11)
Y = 5

Since Y is greater than or equal to 2 we will apply rule 2

Second Check Digit = 11 - 5
Second Check Digit = 6

Final result is 111.333.666-86