Generator · Danish data

Danish CVR

Endpoint GET /v1/dk/cvr

What it covers

Returns a valid Danish CVR (company identifier) with a correct mod-11 check digit. Use `format=vat` for the DK VAT number (`DK` + CVR). Set `invalid=true` for a CVR with a deliberately wrong check digit.

How it’s calculated

The Danish CVR company number's eighth digit is a weighted mod-11 check digit: the 11-complement of the weighted sum of the first seven digits, with the residue that would need a two-digit check treated as unissued.

Algorithm

  1. Take the seven payload digits d1..d7 of the CVR (the first is 1-9 for the common shape; the eighth position is the check digit to be computed).
  2. Multiply each payload digit by its position weight from the sequence 2, 7, 6, 5, 4, 3, 2 (d1x2, d2x7, d3x6, d4x5, d5x4, d6x3, d7x2).
  3. Add the seven products together to get the weighted sum S.
  4. Compute the remainder r = S mod 11.
  5. Compute the complement raw = 11 - r.
  6. If raw == 11, the check digit is 0.
  7. If raw == 10, this prefix has no valid single-digit check digit; it is treated as never issued and must be discarded (redraw a different payload).
  8. Otherwise the check digit is raw itself (a value 1..9).
  9. Append the check digit as the eighth digit to form the full 8-digit CVR. Equivalently, the full number satisfies (2,7,6,5,4,3,2,1)-weighted sum of all eight digits is congruent to 0 mod 11.

Worked example

CVR 1234567? (payload 1234567, check digit ?)

Payload digits: 1,2,3,4,5,6,7 with weights 2,7,6,5,4,3,2.
Products: 1x2=2, 2x7=14, 3x6=18, 4x5=20, 5x4=20, 6x3=18, 7x2=14.
Weighted sum S = 2+14+18+20+20+18+14 = 106.
r = 106 mod 11 = 106 - 99 = 7.
raw = 11 - 7 = 4 (not 10 and not 11, so the check digit is raw).
Check digit = 4.
Cross-check via full-number rule with weights 2,7,6,5,4,3,2,1: 106 + 4x1 = 110, and 110 mod 11 = 0.

The check digit is 4, so the full CVR is 12345674.

Edge cases

  • A payload whose complement raw equals 10 (i.e. S mod 11 == 1) has no single-digit check and is never issued; the generator redraws such prefixes rather than emitting them.
  • When the complement raw equals 11 (i.e. S mod 11 == 0), the check digit is 0 — a valid CVR ending in 0.
  • Leading-zero CVRs are valid: the first payload digit can be 0, which the generator's edge mode deliberately exercises since a numeric parse would silently drop the CVR to seven digits.

Gotchas

  • The generator passes weights for the seven payload digits only (2,7,6,5,4,3,2), not the full eight-digit weight vector 2,7,6,5,4,3,2,1; the trailing weight-1 term is the check digit itself and appears only in the equivalent full-number validation rule.
  • The overflow rule is the primitive's default 'invalid': raw 10 -> undefined (unissued, redraw) and raw 11 -> 0. This is not a mod-10 fold, so no check digit is ever silently coerced.
  • CVR numbers carry no sex, century, or category encoding — the seven leading digits are effectively opaque, so the only structural constraint on a value is this mod-11 check digit.

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 CVRs 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 8-digit CVR (default) or DK VAT number.
invalidbooleanReturn a CVR with a deliberately wrong mod-11 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 or VAT).
digitsstringThe canonical, unprefixed 8-digit CVR.

Other generators for Denmark

See all generators for Denmark →

The same kind of identifier elsewhere

Try it

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