Generator · Romanian data

Romanian CUI/CIF

Endpoint GET /v1/ro/cui

What it covers

Returns a valid Romanian CUI/CIF (company identifier) with a correct control digit. Use `format=vat` for the RO VAT number (RO + CUI). Set `invalid=true` for a CUI with a deliberately wrong control digit.

How it’s calculated

The Romanian CUI (Cod Unic de Înregistrare / fiscal code) check digit is a weighted sum against the fixed key 7,5,3,2,1,7,5,3,2 over the zero-padded 9-digit body, multiplied by 10, taken modulo 11, then modulo 10.

Algorithm

  1. Start with the CUI body — the significant digits before the control digit (in this generator, 6 to 9 digits, first digit 1-9, rest 0-9).
  2. Left-pad the body with zeros to exactly 9 digits.
  3. Define the fixed control key of 9 weights: [7, 5, 3, 2, 1, 7, 5, 3, 2].
  4. Multiply each of the 9 padded digits by the weight in the same position and sum all 9 products (a plain weighted sum, no intermediate modulus).
  5. Multiply that sum by 10.
  6. Take the result modulo 11.
  7. Take that modulo 10 (so a raw remainder of 10 collapses to 0). This single digit 0-9 is the control digit.
  8. Append the control digit to the (unpadded) body to form the full CUI. For a VAT number, prefix the whole thing with 'RO'.

Worked example

CUI body 123456, control digit = ?

Body = "123456" (6 digits). Left-pad with zeros to 9: "000123456" → digits [0,0,0,1,2,3,4,5,6].
Key = [7,5,3,2,1,7,5,3,2].
Products position by position: 0×7=0, 0×5=0, 0×3=0, 1×2=2, 2×1=2, 3×7=21, 4×5=20, 5×3=15, 6×2=12.
weightedSum = 0+0+0+2+2+21+20+15+12 = 72.
72 × 10 = 720.
720 mod 11 = 720 − 65×11 = 720 − 715 = 5.
5 mod 10 = 5.
Control digit = 5; full CUI = 1234565 (VAT form RO1234565).

The control digit is 5, giving the full CUI 1234565.

Edge cases

  • The body is right-aligned against a fixed 9-element key and left-padded with zeros to 9 digits, so bodies shorter than 9 digits effectively use only the rightmost weights.
  • The final `% 10` exists solely to map a modulo-11 remainder of 10 to the digit 0; all other remainders (0-9) pass through unchanged.

Gotchas

  • The multiply-by-10 happens BEFORE the modulo 11 — it is (weightedSum × 10) % 11, not (weightedSum % 11) × something. Omitting the ×10 gives a different, wrong digit.
  • `weightedSum` from number-tools is a bare Σ(digit×weight) with no modulus of its own; the modulus arithmetic is done inline in generate-cui-digits.ts, not by a mod11/mod10 primitive.
  • The VAT form is just the literal prefix 'RO' + the CUI digits; the 'RO' plays no part in the checksum computation.

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 CUIs 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.
format"national" | "vat"Rendering: bare national CUI (default) or RO VAT number.
invalidbooleanReturn a CUI with a deliberately wrong control digit.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.

Response fields

FieldTypeDescription
valuestringThe identifier in the requested format (national or VAT).
digitsstringThe canonical, unprefixed digit string incl. the control digit.

Other generators for Romania

See all generators for Romania →

The same kind of identifier elsewhere

Try it

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