TaxNumber
in package
German tax number (Steuernummer, BT-32) as described in "Prüfung der Steuer- und Steueridentifikationsnummer" of the Bayerisches Landesamt für Steuern (ELSTER, as of 2 September 2026): the 13-digit ELSTER format FFFF0BBBUUUUP (NRW: FFFF0BBBBUUUP), the 12-digit federal format without the 0, and the notation of the federal states on tax notices (e.g. 181/815/08155 in Bavaria, 133/8150/8159 in NRW).
A number is valid when it passes the formal checks and the check digit procedure of its state: the modified 11 procedure (Rhineland-Palatinate), the 2 procedure (Baden-Württemberg, Hesse, Schleswig-Holstein) or the 11 procedure with the factors of the state (all others, Berlin with the variants A and B). A state notation without the state is checked against every state that uses it; as several states share a notation (e.g. FF/BBB/UUUUP), parse() then returns the first valid interpretation unless the state is given. Whether the tax office exists (ELSTER list of tax offices) is not checked.
Table of Contents
Constants
- STATE_PREFIXES : array<string|int, mixed> = ['10' => 'SL', '11' => 'BE', '21' => 'SH', '22'...
- First digits of the ELSTER format (Bundesfinanzamtsnummer) => state (ISO 3166-2:DE).
Properties
Methods
- formatted() : string
- Notation on tax notices, e.g. 181/815/08155 or 133/8150/8159.
- looksLikeVatId() : bool
- A VAT identification number (DE + 9 digits) given as tax number.
- parse() : self|null
- The valid tax number in any notation, or null when it is invalid or cannot be checked.
- validate() : bool|null
- true = valid, false = invalid, null = plausible but not checkable (a Bavarian notation without the tax office number, BBB/UUUUP).
Constants
STATE_PREFIXES
First digits of the ELSTER format (Bundesfinanzamtsnummer) => state (ISO 3166-2:DE).
public
array<string|int, mixed>
STATE_PREFIXES
= ['10' => 'SL', '11' => 'BE', '21' => 'SH', '22' => 'HH', '23' => 'NI', '24' => 'HB', '26' => 'HE', '27' => 'RP', '28' => 'BW', '30' => 'BB', '31' => 'ST', '32' => 'SN', '40' => 'MV', '41' => 'TH', '5' => 'NW', '9' => 'BY']
Properties
$elster
13 digits
public
string
$elster
$state
ISO 3166-2:DE code of the state, e.g. BY
public
string
$state
Methods
formatted()
Notation on tax notices, e.g. 181/815/08155 or 133/8150/8159.
public
formatted() : string
Return values
stringlooksLikeVatId()
A VAT identification number (DE + 9 digits) given as tax number.
public
static looksLikeVatId(string $value) : bool
Parameters
- $value : string
Return values
boolparse()
The valid tax number in any notation, or null when it is invalid or cannot be checked.
public
static parse(string $value[, string|null $state = null ]) : self|null
Parameters
- $value : string
- $state : string|null = null
-
ISO 3166-2:DE code (e.g. BY) to read a state notation
Return values
self|nullvalidate()
true = valid, false = invalid, null = plausible but not checkable (a Bavarian notation without the tax office number, BBB/UUUUP).
public
static validate(string $value[, string|null $state = null ]) : bool|null
Parameters
- $value : string
- $state : string|null = null