Generator · Lithuanian data

Lithuanian įmonės kodas

Endpoint GET /v1/lt/imones-kodas

What it covers

Returns a valid Lithuanian įmonės kodas (company code) with a correct two-pass mod-11 check digit. The code is non-semantic. Set `invalid=true` for an įmonės kodas with a deliberately wrong check digit.

How it’s calculated

The 9th digit of a Lithuanian įmonės kodas is a two-pass ISO 7064-style weighted mod-11 check digit over the first eight digits.

Algorithm

  1. Take the 8-digit payload d1..d8 (the first eight of the nine įmonės kodas digits). The 9th digit is the check digit to be computed.
  2. Pass 1: multiply each payload digit by its position weight from weights1 = [1, 2, 3, 4, 5, 6, 7, 8] (so d1×1, d2×2, ..., d8×8) and sum the eight products.
  3. Compute first = (pass-1 weighted sum) mod 11.
  4. If first < 10, the check digit is first. Stop.
  5. Otherwise (first === 10): Pass 2: multiply each payload digit by its position weight from weights2 = [3, 4, 5, 6, 7, 8, 9, 1] (d1×3, d2×4, ..., d7×9, d8×1) and sum the eight products.
  6. Compute second = (pass-2 weighted sum) mod 11.
  7. If second < 10, the check digit is second. Otherwise (second === 10) the check digit is 0.
  8. Append the resulting single digit as the 9th digit to form the complete įmonės kodas.

Worked example

įmonės kodas 12345678? (payload 12345678, check digit = ?)

Payload digits: d1..d8 = 1,2,3,4,5,6,7,8.
Pass 1 with weights1 = [1,2,3,4,5,6,7,8]: 1×1=1, 2×2=4, 3×3=9, 4×4=16, 5×5=25, 6×6=36, 7×7=49, 8×8=64.
Pass-1 sum = 1+4+9+16+25+36+49+64 = 204.
first = 204 mod 11 = 204 − (11×18=198) = 6.
first = 6 < 10, so the check digit is 6 (second pass not needed).

The check digit is 6, giving the full įmonės kodas 123456786.

Edge cases

  • When the first pass yields residue 10 (no single-digit answer), the algorithm recomputes with the shifted weights2 = [3,4,5,6,7,8,9,1]. This second-pass weight vector is the first-pass weights rotated: positions 1-7 use 3..9 and position 8 wraps back to 1.
  • If BOTH passes yield residue 10, the check digit is forced to 0 (this is the ISO 7064 fallback; the raw '10' is never emitted as a check digit).
  • The generator draws the leading digit d1 in the range 1-9 (never 0), so a numeric parse of the 9-digit code keeps all nine digits; digits d2..d8 are drawn freely 0-9.

Gotchas

  • The check digit is fully determined by the first eight digits, so it can be any value 0-9 (the 0 case can arise either as a genuine residue-0 or as the both-passes-overflow fallback).
  • weights1 and weights2 cover the 8-digit payload only, not the check digit position; the weighted sum runs over exactly eight products in each pass.
  • The two-pass scheme means you cannot validate with a single fixed weight vector — a code whose pass-1 residue is 10 will only validate against the pass-2 (or 0) result, never against the pass-1 remainder.

Parameters

ParameterTypeDescription
countinteger1–1000Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch.
edgebooleanRestrict output to valid edge-case įmonės koods from the rare corners.
extremebooleanReturn 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.
invalidbooleanReturn an įmonės kodas with a deliberately wrong check digit.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.

Response fields

FieldTypeDescription
valuestringThe įmonės kodas in the requested form (currently the bare digits).
digitsstringThe canonical 9-digit įmonės kodas.

Other generators for Lithuania

See all generators for Lithuania →

The same kind of identifier elsewhere

Try it

Generate a live example below — every response is valid by format and entirely synthetic.