Generator · Hungarian data

Hungarian személyi azonosító

Endpoint GET /v1/hu/szemelyi-azonosito

What it covers

Returns a valid Hungarian személyi azonosító (the "személyi szám") with a correct mod-11 check digit. Constrain with `sex` and age/birth-date filters; the number encodes both. Contradictory combinations are rejected with a 400. Use `standard` to pick the weight scheme. Set `invalid=true` for a deliberately wrong check digit.

How it’s calculated

The eleventh digit is a weighted mod-11 check: the weighted sum of the first ten digits taken modulo 11, used directly as the remainder (no 11-complement), with residue 10 never issued because the serial is redrawn.

Algorithm

  1. Assemble the first ten digits. Digit 1 is the sex-and-century code (see below); digits 2-7 are the birth date as YYMMDD (each of year-mod-100, month, day zero-padded to two digits); digits 8-10 are a three-digit serial (0-999, zero-padded).
  2. Pick the position weights by standard. For the 'modern' standard (numbers issued from 1997 onward), weights over the ten digits run descending: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]. For the 'pre-1997' standard, weights run ascending: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].
  3. Compute the weighted sum: multiply each of the ten digits by the weight at the same position and add all ten products together.
  4. Take that sum modulo 11. The result is the check digit (a plain remainder, NOT an 11-complement).
  5. If the remainder equals 10, the value cannot be a single decimal digit: discard this serial, draw a new three-digit serial, and repeat from step 1. A valid check digit is always 0-9.
  6. Append the check digit as the eleventh and final digit. The full személyi azonosító is the ten digits followed by this check digit.

Worked example

Male born 1985-03-14, serial 207, modern standard: leading code 1, YYMMDD = 850314, so first ten digits are 1850314207, check = ?

Leading code: born 1985 (century 1900), male -> code 1.
Birth date YYMMDD: year 85, month 03, day 14 -> 850314.
Serial: 207. First ten digits = 1 850314 207 = 1850314207.
Modern weights (descending): [10,9,8,7,6,5,4,3,2,1].
Products: 1*10=10, 8*9=72, 5*8=40, 0*7=0, 3*6=18, 1*5=5, 4*4=16, 2*3=6, 0*2=0, 7*1=7.
Weighted sum = 10+72+40+0+18+5+16+6+0+7 = 174.
174 mod 11 = 174 - 15*11 = 174 - 165 = 9.
Remainder 9 is a valid single digit (not 10), so the check digit is 9.

The check digit is 9, giving the full személyi azonosító 18503142079.

Edge cases

  • Residue 10: when sum mod 11 == 10 there is no single-digit check, so the generator discards the serial and redraws — meaning any first-ten combination whose only valid check would be 10 is never issued (build-szemelyi.ts, the `if (check === 10) continue;` loop).
  • Leading digit encodes sex AND birth century: 1=male/2=female for 1900-1999, 3=male/4=female for 1800-1899, 5=male/6=female for 2000+. Odd codes are male, even codes female — parity carries the sex.
  • Two weight orderings coexist: the 'pre-1997' standard sums with ascending weights 1..10, the 'modern' (1997+) standard sums with descending weights 10..1, so the same ten digits can produce a different check digit depending on the era standard.

Gotchas

  • The check is a raw remainder (sum mod 11), NOT the 11-complement used by many other European mod-11 identifiers (e.g. DK CVR, PT NIF) — do not subtract from 11.
  • Because the leading digit is itself part of the weighted sum (position 1), the century/sex code participates in the checksum; two people with the same YYMMDD+serial but different century codes get different check digits.
  • The serial (digits 8-10) is the only free draw; when it forces residue 10 the whole number is regenerated with a new serial, so validity of the check digit and choice of serial are coupled.

Parameters

ParameterTypeDescription
atAgeintegerExact age in years at request time.
bornAfterstringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$Born after this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD).
bornBeforestringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$Born before this date or fragment (YYYY, YYYY-MM, YYYY-MM-DD).
bornOnstringpattern ^\d{4}(?:-\d{2}(?:-\d{2})?)?$Born on a date or within a fragment: YYYY, YYYY-MM, or YYYY-MM-DD.
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 values.
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 a number with a deliberately wrong check digit; sex/birth date stay valid.
olderThanintegerMinimum age in years at request time.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.
sex"m" | "f"Encoded sex: "m" or "f".
standard"pre-1997" | "modern" | "both"Which mod-11 weight scheme the check digit honours; `both` mixes them per record.
youngerThanintegerMaximum age in years at request time.

Response fields

FieldTypeDescription
valuestringThe identifier as a bare 11-digit string.
digitsstringThe canonical 11-digit number.
birthDatestringThe encoded birth date, ISO `YYYY-MM-DD`.
sex"m" | "f"Encoded sex: `m` (odd code) or `f` (even code).
standard"pre-1997" | "modern"Which checksum standard the number satisfies.

Other generators for Hungary

See all generators for Hungary →

The same kind of identifier elsewhere

Try it

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