PIS/PASEP

The PIS/PASEP/NIT worker registration number (PIS: Programa de Integração Social).

  • Parity matrix

Validate

Validates a PIS/PASEP/NIT: 10 base digits and a modulus 11 check digit.

  • No official source publishes the check-digit weights. The eSocial MOS gives 11 digits with the check digit, and the SIRC manual says the check digit uses modulus 11; the Caixa layouts ask only for a "Número de PIS/PASEP válido". The weights follow a community reference (brutils).
  • The function ignores whitespace and the characters ., -, /, (, ), , and *, in any number and position. Any other character makes the value invalid. Exactly 11 digits are required once they are removed, and the check digit must match.
  • The check-digit weights are 3, 2, 9, 8, 7, 6, 5, 4, 3 and 2 over the first 10 digits, with modulus 11.
  • Only a string is read. Any other type returns false.

Pending decision

The reference (JS) rejects a value whose digits are all the same as a reserved number. The other libraries accept them when the check digit matches. See the open decision in docs/findings.md.

Pending decision

The reference (JS) ignores those formatting characters and whitespace. Other libraries accept digits only. See the open decision in docs/findings.md.

ParameterTypeRequired
pisstringyes
returnsboolean

Check if a PIS is valid. Accepts the value masked or not.

  • A value whose digits are all the same is rejected.
  • The check digit uses the weights 3, 2, 9, 8, 7, 6, 5, 4, 3 and 2 and módulo 11. No official document found publishes them: the eSocial and SIRC manuals say only that the number has 11 digits and a módulo 11 check digit, and the Caixa layouts ask for a "Número de PIS/PASEP válido" without saying how it is computed. The weights follow brutils.
import { isValidPis } from '@brazilian-utils/brazilian-utils';

isValidPis('12056412847'); // true
isValidPis('12056412547'); // false
Code: brazilian-utils/javascript
Try it with JavaScript isValidPis
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (31) and the result in each library pis.isValid

Format

Formats a PIS as 000.00000.00-0.

  • options.pad left-pads the value with zeros to 11 digits first.
  • options.obfuscate (default false) hides the first 3 digits and the check digit with *, after padding: ***.45678.90-*. It works with pad and on a partial value. Like pad, it is read for truthiness: a non-boolean such as 1 hides the digits too, and 0 does not.
  • No authority publishes a masking rule for the PIS. The rule is an analogy with the one the Leis de Diretrizes Orçamentárias set for publishing a CPF ("ocultar os três primeiros dígitos e os dois dígitos verificadores", Lei nº 12.309/2010, art. 87, § 5º, repeated up to the LDO 2026, Lei nº 15.321/2025, art. 163), not a published norm.
  • cns.format and passport.format have no obfuscate option.
  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string (2.4.0 read the digits of any number, sign and decimal point dropped).
  • A value with no digits (empty, or only letters and symbols) returns an empty string even with options.pad. Until 2.4.0 pad returned the full zero mask (000.00000.00-0).
  • Digits after the 11th are dropped.

Pending decision

The reference (JS) formats only the characters an incomplete value has and returns an empty string for empty or invalid input. Other libraries return null. See the open decision in docs/findings.md.

ParameterTypeRequired
valuestring | numberyes
optionsFormatPisOptionsno
options.padbooleanno
options.obfuscatebooleanno
returnsstring

Format a PIS.

  • Options (FormatPisOptions): pad left-pads the value with zeros to 11 digits before masking (default false); obfuscate hides the first 3 digits and the check digit. An empty value, or one without digits, gives '' even with pad.
  • obfuscate is applied after pad.
  • No authority publishes a masking rule for the PIS, so obfuscate applies the one the Leis de Diretrizes Orçamentárias set for publishing a CPF ("ocultar os três primeiros dígitos e os dois dígitos verificadores", Lei nº 14.194/2021, art. 149, first set by Lei nº 12.309/2010, art. 87, § 5º), a number with the same structure.
import { formatPis } from '@brazilian-utils/brazilian-utils';

formatPis('12345678901'); // 123.45678.90-1
formatPis('123456789', { pad: true }); // 001.23456.78-9
formatPis('12345678901', { obfuscate: true }); // ***.45678.90-*
Code: brazilian-utils/javascript
Try it with JavaScript formatPis
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (70) and the result in each library pis.format

Parse

Removes PIS formatting and keeps only digits, capped at 11 digits (the digits after the 11th are dropped).

  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string (2.4.0 read the digits of any number, sign and decimal point dropped).
  • A value with no digits returns an empty string.
ParameterTypeRequired
valuestring | numberyes
returnsstring

Remove PIS formatting, keep only digits, and cap the result to 11 digits.

import { parsePis } from '@brazilian-utils/brazilian-utils';

parsePis('123.45678.90-1'); // 12345678901
Code: brazilian-utils/javascript
Try it with JavaScript parsePis
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (18) and the result in each library pis.parse

Generate

Generates a valid random PIS: 11 digits, unformatted.

  • No official source publishes the check-digit weights. The eSocial MOS gives 11 digits with the check digit, and the SIRC manual says the check digit uses modulus 11; the Caixa layouts ask only for a "Número de PIS/PASEP válido". The weights follow a community reference (brutils).
ParameterTypeRequired
returnsstring

Generate a valid random PIS.

import { generatePis } from '@brazilian-utils/brazilian-utils';

generatePis(); // '91077906857'

Source: Lei nº 14.194/2021, art. 149, the CPF masking rule obfuscate borrows, first set by Lei nº 12.309/2010, art. 87, § 5º and repeated by the later LDOs (Lei nº 15.321/2025, art. 163, the one for 2026, repeats it).

Code: brazilian-utils/javascript
Try it with JavaScript generatePis
The inputs start with the first shared case. Change one to see the new result.

Runs @brazilian-utils/brazilian-utils 2.5.0 in your browser.

Shared test cases (1) and the result in each library pis.generate

Official sources

Last updated on

On this page