Skip to content

VAT-EU

The Polish EU VAT number (Numer VAT UE) is Poland’s NIP prefixed with the country code PL, used for intra-EU transactions. Validation strips the prefix and applies the standard NIP MOD-11 algorithm.

import { Numerik } from '@slashlab/numerik-js'
// Boolean
Numerik.vatEu().isValid('PL5260250274') // true
// Rich result
const result = Numerik.vatEu().validate('PL5260250274')
result.isValid // true
// Parse to value object
const vatEu = Numerik.vatEu().parse('PL5260250274')
// Null on failure instead of exception
const maybe = Numerik.vatEu().tryParse('bad-input') // null

Separators in the NIP portion are accepted:

Numerik.vatEu().isValid('PL526-025-02-74') // true

parse() and tryParse() return a VatEu instance.

MethodReturn typeDescription
getRaw()stringThe original input, untouched.
getNormalized()stringPL prefix followed by 10 raw digits.
toString()stringAlias for getNormalized().
MethodReturn typeDescription
getCountryCode()stringAlways 'PL'.
getNip()stringThe 10-digit NIP portion (without prefix).
getFormatted()stringPL + canonical NNN-NNN-NN-NN display form.
const vatEu = Numerik.vatEu().parse('PL5260250274')
vatEu.getRaw() // 'PL5260250274'
vatEu.getNormalized() // 'PL5260250274'
vatEu.getCountryCode() // 'PL'
vatEu.getNip() // '5260250274'
vatEu.getFormatted() // 'PL526-025-02-74'
ReasonValueWhen
InvalidLengthinvalid_lengthInput does not produce exactly 10 NIP digits after stripping the prefix and separators.
InvalidCharactersinvalid_charactersCharacters other than PL, digits, hyphens, and spaces are present.
InvalidFormatinvalid_formatMissing PL prefix, or first 3 NIP digits are 000.
InvalidChecksuminvalid_checksumNIP checksum digit does not match.
AllSameDigitall_same_digitAll 10 NIP digits are identical — strict mode only.
  1. Assert the input begins with PL (case-insensitive).
  2. Strip the PL prefix, then strip hyphens and spaces from the remaining digits.
  3. Apply the full NIP validation algorithm to the remaining 10 digits.

See Algorithms for the full NIP reference.