Skip to content

REGON

REGON (Rejestr Gospodarki Narodowej) is Poland’s business registry identifier. It exists in two forms:

  • 9 digits — for individual entities (sole traders, natural persons).
  • 14 digits — for legal entities with local units (the first 9 digits are the base REGON, the last 5 identify the local unit).
use SlashLab\Numerik\Numerik;
// Boolean
Numerik::regon()->isValid('850518457'); // true (9-digit)
Numerik::regon()->isValid('85051845749370'); // true (14-digit)
// Rich result
$result = Numerik::regon()->validate('850518457');
$result->isValid; // true
// Parse to value object
$regon = Numerik::regon()->parse('850518457');
// Null on failure instead of exception
$regon = Numerik::regon()->tryParse('bad-input'); // null

parse() and tryParse() return a SlashLab\Numerik\ValueObjects\Regon instance.

MethodReturn typeDescription
getRaw()stringThe original input, untouched.
getNormalized()stringWhitespace-stripped digits.
__toString()stringSame as getNormalized().
MethodReturn typeDescription
getType()RegonTypeRegonType::Individual (9-digit) or RegonType::LegalEntity (14-digit).
getBaseRegon()stringFirst 9 digits — always present for both types.
getLocalUnitSuffix()string|nullLast 5 digits for 14-digit numbers; null for 9-digit.
isLocalUnit()booltrue for 14-digit (legal entity with local unit).
// 9-digit REGON
$regon = Numerik::regon()->parse('850518457');
$regon->getType(); // RegonType::Individual
$regon->getBaseRegon(); // '850518457'
$regon->getLocalUnitSuffix(); // null
$regon->isLocalUnit(); // false
// 14-digit REGON
$regon = Numerik::regon()->parse('85051845749370');
$regon->getType(); // RegonType::LegalEntity
$regon->getBaseRegon(); // '850518457'
$regon->getLocalUnitSuffix(); // '49370'
$regon->isLocalUnit(); // true
ReasonValueWhen
InvalidLengthinvalid_lengthInput is not exactly 9 or 14 digits after normalisation.
InvalidCharactersinvalid_charactersNon-digit characters remain after stripping whitespace.
InvalidChecksuminvalid_checksumChecksum digit does not match. For 14-digit, can refer to either the base 9-digit check or the full 14-digit check.

9-digit weights: 8, 9, 2, 3, 4, 5, 6, 7

14-digit weights: 2, 4, 8, 5, 0, 9, 7, 3, 6, 1, 2, 4, 8

9-digit validation:

  1. Strip whitespace. Assert exactly 9 digits.
  2. Multiply the first 8 digits by the 9-digit weights, sum, take mod 11. If the result is 10, the checksum digit must be 0. Otherwise the result must equal digit 9.

14-digit validation:

  1. Strip whitespace. Assert exactly 14 digits.
  2. Validate the first 9 digits as a standalone 9-digit REGON.
  3. Multiply all 13 significant digits by the 14-digit weights, sum, take mod 11. If the result is 10, checksum digit must be 0. Otherwise the result must equal digit 14.

See Algorithms for the full reference.

If this saved you time → ☕ Buy me a coffee