Generator · Croatian data

Croatian OIB

Endpoint GET /v1/hr/oib

What it covers

Returns a valid Croatian OIB (the single identifier for both persons and companies) with a correct ISO 7064 MOD 11,10 check digit. Use `format` for the HR VAT number. Set `invalid=true` for an OIB with a deliberately wrong check digit.

How it’s calculated

The Croatian OIB's 11th digit is an ISO/IEC 7064 MOD 11,10 check digit computed over the first ten digits by a pure recursive (non-weighted) recurrence.

Algorithm

  1. Take the ten payload digits d1..d10 (left to right). In the generator the first digit is drawn 1-9 and the remaining nine are 0-9, but the algorithm works for any decimal digit.
  2. Initialize a running value `product = 10`.
  3. For each payload digit d, in order: compute `sum = (d + product) mod 10`.
  4. If `sum == 0`, remap it to `sum = 10` (this is the key MOD 11,10 mapping of a zero intermediate).
  5. Update `product = (sum * 2) mod 11`.
  6. After all ten digits are processed, the check digit is `(11 - product) mod 10`. This always yields a single decimal digit 0-9 (no unrepresentable residue, so no redraw is ever needed).
  7. Append that check digit as the 11th digit to form the full OIB.

Worked example

OIB payload 1234567890 with check digit ?

Start product = 10.
d=1: sum=(1+10)%10=1; product=(1*2)%11=2
d=2: sum=(2+2)%10=4; product=(4*2)%11=8
d=3: sum=(3+8)%10=1; product=(1*2)%11=2
d=4: sum=(4+2)%10=6; product=(6*2)%11=12%11=1
d=5: sum=(5+1)%10=6; product=(6*2)%11=12%11=1
d=6: sum=(6+1)%10=7; product=(7*2)%11=14%11=3
d=7: sum=(7+3)%10=0 -> remap to 10; product=(10*2)%11=20%11=9
d=8: sum=(8+9)%10=7; product=(7*2)%11=14%11=3
d=9: sum=(9+3)%10=2; product=(2*2)%11=4
d=0: sum=(0+4)%10=4; product=(4*2)%11=8
Check digit = (11 - 8) % 10 = 3

The check digit is 3, so the full OIB is 12345678903.

Edge cases

  • The check digit is fully determined by the first ten digits, so exactly one of the ten possible 11th digits is valid; the corrupt-check-digit edge helper offsets the correct digit by 1..9 mod 10 to guarantee an invalid but well-formed OIB.
  • The generator's normal path draws the first payload digit as 1-9 (non-leading-zero); a leading-zero payload is a corner reserved for the edge generator, though the checksum math itself is unaffected by it.

Gotchas

  • This is the pure recursive ISO 7064 MOD 11,10 system, NOT a weighted mod-11 sum — there are no per-position weights; the state is folded through `+ mod 10` (with 0->10 remap) then `*2 mod 11` at each step.
  • Because MOD 11,10 always produces a single decimal digit, there is never an 'X' or a redraw case, unlike weighted mod-11 schemes that can yield residue 10.
  • The zero-remap step (`if sum == 0 then sum = 10`) is essential; omitting it produces wrong check digits for any intermediate that lands on 0.

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 OIBs 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 11-digit OIB (default), or HR-prefixed VAT number.
invalidbooleanReturn an OIB with a deliberately wrong ISO 7064 check digit.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.

Response fields

FieldTypeDescription
valuestringThe OIB in the requested format (national or VAT).
digitsstringThe canonical, unprefixed 11-digit OIB.

Other generators for Croatia

See all generators for Croatia →

The same kind of identifier elsewhere

Try it

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