Generator · Lithuanian data
Lithuanian asmens kodas
Endpoint GET /v1/lt/asmens-kodas
What it covers
Returns a valid Lithuanian asmens kodas with a correct two-pass mod-11 check digit. Constrain with `sex` and age/birth-date filters (the code encodes the full birth date and sex). Contradictory combinations are rejected with a 400. Set `invalid=true` for a deliberately wrong check digit.
How it’s calculated
The 11th digit of a Lithuanian asmens kodas is a two-pass (ISO 7064-style) weighted mod-11 check digit over the first ten digits.
Algorithm
- Assemble the 10-digit payload as G YYMMDD NNN: leading digit G (century+sex), the two-digit year-within-century YY, two-digit month MM, two-digit day DD, and a three-digit serial NNN. This is exactly the first ten digits of the personal code.
- Split the payload into its ten individual digit values d1..d10 (d1 is the leading digit G, d10 is the last serial digit). Leading zeros are significant.
- First pass: multiply each digit by its position weight from weights1 = [1,2,3,4,5,6,7,8,9,1] (so d1·1, d2·2, ..., d9·9, d10·1) and sum the products.
- Take that sum modulo 11. If the result is less than 10, that result IS the check digit — stop.
- Second pass (only if the first pass gave exactly 10): multiply the same ten digits by weights2 = [3,4,5,6,7,8,9,1,2,3] and sum the products.
- Take the second sum modulo 11. If it is less than 10, that result is the check digit.
- If the second pass also gives 10, the check digit is 0.
- Append the resulting check digit as the 11th digit to form the full personal code.
Worked example
Male, born 1985-06-15, serial 137 → G=3, YYMMDD=850615, NNN=137, full code 3850615137?
Leading digit G: birth year 1985 → century 1900, sex male → base 3 + offset 0 = 3.
Date head YYMMDD: year 1985 mod 100 = 85, month 06, day 15 → 850615.
Serial NNN = 137. Payload = 3 | 850615 | 137 = 3850615137.
Digits d1..d10 = 3,8,5,0,6,1,5,1,3,7.
First-pass weights [1,2,3,4,5,6,7,8,9,1]: 3·1=3, 8·2=16, 5·3=15, 0·4=0, 6·5=30, 1·6=6, 5·7=35, 1·8=8, 3·9=27, 7·1=7.
Sum = 3+16+15+0+30+6+35+8+27+7 = 147.
147 mod 11 = 4 (11·13 = 143, remainder 4). 4 < 10, so no second pass is needed.
Check digit = 4.The check digit is 4, giving the full asmens kodas 38506151374.
Edge cases
- The leading digit G encodes both century and sex: 1=1800s male, 2=1800s female, 3=1900s male, 4=1900s female, 5=2000s male, 6=2000s female. Odd G is male, even G is female (see leading-digit.ts).
- If the first-pass residue is exactly 10, a second pass with weights [3,4,5,6,7,8,9,1,2,3] is run; only if THAT is also 10 does the check digit fall back to 0. This is the two-pass ISO 7064-style rule, not a plain single mod-11.
- The generator restricts encodable birth years to 1800–2099 (G values 1–6); years outside that range throw rather than produce a code (leadingDigitFor).
Gotchas
- weights1 and weights2 both have length 10 and cover the payload only — the 11th (check) digit is not weighted; weightedSum throws if the digit count and weight count differ.
- The final weight in weights1 is 1 (not 10): the pattern is 1,2,3,4,5,6,7,8,9 then wraps to 1 for the tenth position; weights2 continues the cycle as 3,4,5,6,7,8,9,1,2,3.
- toDigits parses the payload as a string so leading zeros are preserved and never round-tripped through Number.
Parameters
| Parameter | Type | Description |
|---|---|---|
| atAge | integer | Exact age in years at request time. |
| bornAfter | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born after this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD). |
| bornBefore | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born before this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD). |
| bornOn | stringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$ | Born on a date or within a fragment: YYYY, YYYY-MM, or YYYY-MM-DD. |
| count | integer1–1000 | Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch. |
| edge | boolean | Restrict output to edge-case values. |
| extreme | boolean | Return a correct value wrapped in a hostile encoding (untrimmed whitespace, invisible/zero-width characters, BOM, or bidi/combining marks). Homoglyphs are excluded so the value stays machine-parseable; it still validates after normalisation. |
| invalid | boolean | Return an asmens kodas with a deliberately wrong check digit; birth date/sex stay valid. |
| olderThan | integer | Minimum age in years at request time. |
| seed | integer | Integer seed for reproducible output: the same seed always yields the same record. |
| sex | "m" | "f" | Encoded sex: "m" or "f". |
| youngerThan | integer | Maximum age in years at request time. |
Response fields
| Field | Type | Description |
|---|---|---|
| value | string | The asmens kodas in the requested form (currently the bare digits). |
| digits | string | The canonical 11-digit asmens kodas. |
| birthDate | string | The encoded birth date, ISO `YYYY-MM-DD`. |
| sex | "m" | "f" | Encoded sex: `m` (odd leading digit) or `f` (even leading digit). |
Other generators for Lithuania
Lithuanian companyLithuanian company nameLithuanian email addressLithuanian IBANLithuanian įmonės kodasLithuanian personLithuanian person nameLithuanian product or service offeringLithuanian PVM (VAT) numberLithuanian vehicle registration plate
See all generators for Lithuania →The same kind of identifier elsewhere
Austrian data · Austrian SVNRBelgian data · Belgian RijksregisternummerBulgarian data · Bulgarian EGNCroatian data · Croatian JMBGCroatian data · Croatian OIBCypriot data · Cyprus TICCzech data · Czech rodné čísloDanish data · Danish CPRDutch data · Dutch BSNEstonian data · Estonian isikukoodFinnish data · Finnish henkilötunnusFinnish data · Finnish Y-tunnusFrench data · French NIRGerman data · German Steuer-IdNrGreek data · Greek AFMGreek data · Greek AMKAHungarian data · Hungarian adóazonosító jelHungarian data · Hungarian személyi azonosítóHungarian data · Hungarian TAJIrish data · Irish PPSNItalian data · Italian Codice FiscaleLatvian data · Latvian personas kodsLuxembourg data · Luxembourg matriculePolish data · Polish PESELPortuguese data · Portuguese NIFRomanian data · Romanian CNPSlovak data · Slovak rodné čísloSlovenian data · Slovenian davčna številkaSlovenian data · Slovenian EMŠOSpanish data · Spanish DNISpanish data · Spanish NIESwedish data · Swedish personnummer
Try it