Skip to content
useToolz online tools
INN Validation: Check Digit Verification Algorithm
Documents

INN Validation: Check Digit Verification Algorithm

Александр Михеев

Александр Михеев

21 October 2024 · 4 min read

INN validation is a mandatory step in data processing for any system that handles Russian business requisites. A simple length check is not enough: you need to verify that the check digits are calculated correctly. In this article, we'll walk through the validation algorithm step by step, show examples, and discuss common errors.

Why Validate the INN

INNs are entered manually into forms hundreds of thousands of times every day — in accounting systems, banking apps, and government portals. Manual entry inevitably leads to typos: transposed digits, missing characters, or extra digits. Check digit validation allows you to instantly filter out the vast majority of errors before the data even reaches the server.

Data quality directly impacts business processes. An incorrect INN can lead to errors in tax reporting, payment processing failures, and problems when exchanging documents with business partners.

Validation Algorithm for a 10-Digit INN

A legal entity's INN consists of 10 digits. The last digit is the check digit. The validation algorithm:

  • Step 1. Verify that the number contains exactly 10 digits.
  • Step 2. Take the weight coefficients: [2, 4, 10, 3, 5, 9, 4, 6, 8].
  • Step 3. Multiply each of the first 9 INN digits by its corresponding coefficient.
  • Step 4. Sum all the products.
  • Step 5. Calculate the remainder of dividing the sum by 11.
  • Step 6. If the remainder equals 10, the check digit is 0; otherwise, the check digit equals the remainder.
  • Step 7. Compare the result with the 10th digit of the INN. If they match, the number is valid.

Calculation Example

Let's validate the INN 7707083893:

7×2 + 7×4 + 0×10 + 7×3 + 0×5 + 8×9 + 3×4 + 8×6 + 9×8 = 14 + 28 + 0 + 21 + 0 + 72 + 12 + 48 + 72 = 267

267 mod 11 = 3 (since 267 = 24 × 11 + 3)

The check digit is 3, which matches the last digit of the INN. The number is valid.

Validation Algorithm for a 12-Digit INN

An individual's INN contains 12 digits and two check digits (the 11th and 12th). Validation is performed in two stages:

Verifying the 11th Digit

Weight coefficients: [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]. Multiply the first 10 digits by their corresponding coefficients, sum the results, and take the remainder of dividing by 11. If the remainder equals 10, the check digit is 0.

Verifying the 12th Digit

Weight coefficients: [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]. Multiply the first 11 digits by their corresponding coefficients, sum them, and take the remainder of dividing by 11. The rule for a remainder of 10 is the same.

The INN is considered valid if both check digits match the calculated values.

Common Input Errors

In practice, users make the following typical mistakes:

  • Transposed adjacent digits — the most common typo. The checksum catches these cases almost every time.
  • Incorrect number length — entering 11 or 9 digits. A basic length check eliminates this before the checksum calculation even begins.
  • Letters in the number — sometimes users accidentally switch their keyboard layout. The number must contain only digits.
  • Confusion between individual and organization INNs — a user enters their 12-digit personal INN into a field that expects a 10-digit corporate INN.

Integrating Validation into Code

When implementing INN validation in code, it's recommended to follow this order of checks:

  • Remove spaces and other non-numeric characters.
  • Verify that the string contains only digits.
  • Check the length: 10 or 12 characters.
  • Calculate the check digits using the algorithm.
  • Return a clear error message to the user.

If you're developing an API, provide a separate error code for an invalid INN — this simplifies debugging on the client side.

Validation Tool

For quick INN validation without writing code, use our INN validator. It instantly checks the check digits and displays the result. If you need test numbers for development, use the INN generator. We also recommend checking out the OGRN validator — another important requisite for working with legal entity data.

Понравилась статья?

Оцените — это помогает нам делать контент лучше

Change rating

Your rating:

Thanks for your rating!

Comments

Log in to leave a comment

No comments yet. Be the first!

We use cookies for site operation and analytics. Подробнее

Upscaled image
Download

Log in to continue

or