Generator · Bulgarian data

Bulgarian EIK

Endpoint GET /v1/bg/eik

What it covers

Returns a valid Bulgarian EIK (Единен идентификационен код, the company/Bulstat number) with a correct two-stage check digit. Use `format=vat` for the BG VAT number (`BG` + EIK). Set `invalid=true` for an EIK with a deliberately wrong check digit.

How it’s calculated

The 9th digit of a Bulgarian EIK/BULSTAT is a two-stage weighted-sum modulo-11 check digit over the eight preceding digits, with a fallback second weight set used only when the first stage produces the ambiguous residue 10.

Algorithm

  1. Take the eight payload digits d1 d2 d3 d4 d5 d6 d7 d8 (positions 1 through 8, left to right). The first digit d1 is 1-9; the rest are 0-9.
  2. STAGE ONE: multiply each digit by its stage-one weight, where the weights are [1, 2, 3, 4, 5, 6, 7, 8] applied in order (d1*1, d2*2, ..., d8*8). Sum all eight products.
  3. Compute residueOne = (stage-one sum) mod 11.
  4. If residueOne is less than 10, the check digit is residueOne. Stop.
  5. STAGE TWO (only reached when residueOne == 10): multiply each of the same eight digits by its stage-two weight, where the weights are [3, 4, 5, 6, 7, 8, 9, 10] applied in order (d1*3, d2*4, ..., d8*10). Sum all eight products.
  6. Compute residueTwo = (stage-two sum) mod 11.
  7. If residueTwo == 10, the check digit is 0; otherwise the check digit is residueTwo.
  8. Append the resulting single check digit as the 9th digit to form the full 9-digit EIK.

Worked example

EIK payload 1234 5678 with check digit ? -> 12345678?

Payload digits: [1, 2, 3, 4, 5, 6, 7, 8].
Stage-one weights: [1, 2, 3, 4, 5, 6, 7, 8].
Products: 1*1=1, 2*2=4, 3*3=9, 4*4=16, 5*5=25, 6*6=36, 7*7=49, 8*8=64.
Stage-one sum = 1+4+9+16+25+36+49+64 = 204.
residueOne = 204 mod 11: 11*18 = 198, 204 - 198 = 6, so residueOne = 6.
residueOne (6) is less than 10, so the check digit is 6. Stage two is not needed.

The check digit is 6, so the full 9-digit EIK is 123456786.

Edge cases

  • Stage two is only ever consulted when the stage-one residue equals exactly 10; for every other payload the check digit is simply the stage-one residue (0-9).
  • When the stage-two residue is also 10, the check digit is mapped to 0 rather than being left as a two-character value, keeping the identifier a single 9-digit string.

Gotchas

  • The weighted sum here is a plain positional sum (weightedSum) taken directly mod 11 — it is NOT an 11-complement scheme; the residue itself is the check digit, so residue 0 yields check digit 0.
  • This generator produces the 9-digit EIK form (legal entities / sole traders). The 13-digit BULSTAT form used by branches and some registrations has its own separate two-weight rule and is not what this generator emits.
  • Weights start at 1 (not the position index+? offset seen in some schemes): d1 is multiplied by 1 in stage one and by 3 in stage two.

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 EIKs 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 9-digit EIK (default) or BG VAT number.
invalidbooleanReturn an EIK with a deliberately wrong check digit.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.

Response fields

FieldTypeDescription
valuestringThe identifier in the requested format (national EIK or BG VAT).
digitsstringThe canonical, unprefixed 9-digit EIK.

Other generators for Bulgaria

See all generators for Bulgaria →

The same kind of identifier elsewhere

Try it

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