DISCLAIMER: This application is not affiliated with any government entity.
The Spanish National Identity Document (DNI) is a credit card-sized document issued by the Ministry of the Interior through the National Police, which certifies the identity and personal data of its holder, as well as their Spanish nationality.
At the bottom of the back of the DNI, there is a series of OCR-B characters intended to be machine-readable according to ICAO standards for documents (Doc 9303 - Machine-Readable Travel Documents, Part 3):
https://www.icao.int/sites/default/files/publications/DocSeries/9303_p3_cons_es.pdf
These characters correspond to the data that appears on the front, such as the document number, the date of birth and validity of the document, the name and surnames, or the DNI number itself.
Among these OCR characters appear four check digits (indicated in red or green in the application).
One of them is the infamous lone number at the end of the second line.
This application calculates these digits based on the entered data, thus demonstrating that they are not based on certain urban legends.
Don't hesitate to try it.