Skip to main content
Skip to main content

Costa Rica DIMEX Validator (Foreigner ID / DGME)

Validate the structural syntax, prefix rules, and digit length of 11-digit and 12-digit Costa Rican DIMEX numbers.

How does Costa Rica DIMEX validation work?

The validator checks that the string contains 11 or 12 decimal digits, starts with '1' indicating a migration registry document, and is not composed of all identical or all zero digits.

Both plain numeric inputs and hyphenated formats (e.g. 1172-00012345) are accepted.

DIMEX Structure

Composition of the 11 or 12 digits:

PositionFieldLengthMeaningExample
1-3Category3 digitsOfficial DGME prefix117
4-11/12Sequential8 or 9 digitsRegistry sequential number200012345

Validation Algorithm

Rules checked by the validator:

Length = 11 or 12 digits
  1. 1. Remove hyphens and whitespace characters.
  2. 2. Confirm digit count is either 11 or 12.
  3. 3. Verify initial digit is '1'.
  4. 4. Reject repeated single digits.
  5. 5. Reject all-zero sequential suffixes.

Frequently Asked Questions (FAQ)