NIP

NIP is the Polish tax identification number. It has ten digits, and the last is a check digit.

What a NIP is

Ten digits. The first three are the code of the tax office that gave out the number. Beyond that, the number says nothing about its owner.

The check digit

Multiply the first nine digits by 6, 5, 7, 2, 3, 4, 5, 6, 7, add up the products and divide by 11. The remainder is the check digit. A remainder of 10 does not fit in one digit, so those nine digits never start a valid NIP.

Valid NIP numbers for your tests

terminal
$ qadg quick nip --count 5 --seed example
2395551095
8285487488
9176799982
7866802459
5515691915

The program never picks nine digits that would leave a remainder of 10. No block of NIP numbers is set aside for testing, so a generated one can match a real one: keep it in test systems.

What your application should do with a broken one

Refuse a NIP whose check digit does not match, and one whose first nine digits leave a remainder of 10. A changed digit always shows. Some swaps of two neighbouring digits do not, so the program does not count such a swap as damage and says so in the manifest.

Broken ones for your tests

The recipe below makes 100 values and asks for damage in 20% of the rows. Download it and run it as it is, then change the count or the share to fit your tests.

The recipe

nip.yaml
# Polish NIP numbers for testing, with one broken value asked for in about a
# fifth of the rows.
#
# A NIP can match a real one, so keep the file in test systems. The damage
# changes a digit or swaps two, and the manifest says your application should
# reject each one. It also lists the damage this build could not carry out, with
# the reason.
#
#   qadg generate nip.yaml
#
# writes company.csv, expectation-manifest.json and run-note.json. The same seed
# breaks the same values on every machine.
version: "0.1"
seed: "nip"
locale: pl-PL
entities:
  company:
    count: 100
    fields:
      nip: { generator: nip }
policy:
  layers: [L3]
  rows: 20%
  per_row: exactly_one
output:
  format: csv

Run it

Save the recipe, then run this in the same folder. This is what the program printed for it.

terminal
$ qadg generate nip.yaml
       company: 100 rows, 1 column
1 table, 100 rows written
20 defects ordered, 5 applied, manifest in expectation-manifest.json
15 defects could not be applied, and the manifest carries the reason for each one
  3 because this run lacks something they need, and the manifest says what for each one
  12 because this build has no implementation of them yet

What it damaged

The recipe ordered 20 defects, and this build applied the 5 below. The other 15 are in the manifest as not applied, each with its reason, and the run above counts them by reason.

L3.checksum.transposed_digitsreject

company 3, column nip

1831109071 → 1831019071

L3.checksum.off_by_onereject

company 35, column nip

4968114483 → 4968114484

L3.checksum.transposed_digitsreject

company 43, column nip

9568203240 → 9586203240

L3.checksum.off_by_onereject

company 77, column nip

6410425564 → 6410425565

L3.checksum.transposed_digitsreject

company 81, column nip

8557790500 → 8557709500

Sources

  • Ministry of Finance of Poland, POLAND - Information on Tax Identification Numbers, on the European Commission’s TIN portal, read on 2 August 2026.