Civil registry certificate

The 32-digit matrícula of a certidão de registro civil (birth, marriage, death and the other acts of the registro civil das pessoas naturais).

  • Parity matrix

Validate

Validates the 32-digit matrícula of a certidão de registro civil (art. 473 of the Código Nacional de Normas da Corregedoria Nacional de Justiça).

  • Layout: CNS da serventia (6), acervo (2), serviço (2, always 55), ano (4), tipo do livro (1), livro (5), folha (3), termo (7) and 2 modulus 11 check digits.
  • The serviço must be 55. The book type must be 1 to 7 (the books of art. 473 V) or 8 (emancipation, Livro E split for emancipações) or 9 (interdiction, Livro E split for interdições), which come from the revoked Provimento CNJ 3/2009, art. 7º V, and are kept because certidões issued under it from 2010 still carry them. The function rejects 0, whatever the check digits.
  • options.accept limits the valid book types to the listed ones (default: every type).
  • Accepts the value unmasked or masked. Between the nine groups (6 2 2 4 1 5 3 7 2) any run of whitespace, ., - or / is allowed, and whitespace around the value is ignored; another separator (#), a letter, or digits grouped differently make the value invalid.
  • No official source publishes the check-digit algorithm. Art. 473 IX only names the check digits (positions 31 and 32). Provimento CNJ 3/2009 had them generated by a program the CNJ gave to the registrars, and the Caixa's Cadastro NIS layout says only "módulo 11". The modulus 11 weights and remainder rule (a remainder of 10 is read as 1) follow community reference implementations.
  • Only a string is accepted. The 32 digits of a matrícula do not fit a number.
  • options.accept is a list of book types (birth, marriage, religious-marriage, death, stillbirth, banns, other, emancipation, interdiction). When it is missing or not a list, every type is accepted. An empty list accepts none, so the result is false.
ParameterTypeRequired
valuestringyes
optionsIsValidCertidaoOptionsno
options.acceptCertidaoType[]no
returnsboolean

Check if the matrícula of a certidão de registro civil (birth, marriage, death and the other acts of a registro civil das pessoas naturais) is valid. Only a string is accepted: the 32 digits of a matrícula are more than a JavaScript number can hold.

The matrícula has 32 digits, printed as 000000 00 00 0000 0 00000 000 0000000 00:

DigitsField
6CNS da serventia
2acervo
2serviço, always 55
4ano
1tipo do livro
5livro
3folha
7termo
2dígitos verificadores
  • Options (IsValidCertidaoOptions): accept narrows the valid book types (CertidaoType) to the listed ones (default: every type).
  • The serviço must be 55, and the book-type digit one of the codes 1 to 9: 1 to 7 are the books of art. 473, V (Provimento CNJ nº 149/2023, redação of the Provimento CN nº 182/2024); 8 ("emancipation", Livro E desdobrado for emancipações) and 9 ("interdiction", Livro E desdobrado for interdições) come from the Provimento CNJ nº 3/2009, art. 7º, revoked by the Provimento CNJ nº 63/2017, and are kept so the certidões issued under it from 2010 on still validate. 0 is rejected.
  • Accepts the value masked or not, with whitespace between and around the groups.
  • No official document publishes the check digit algorithm: art. 473, IX only names the two digits, the revoked Provimento CNJ nº 3/2009 had them computed by a program the CNJ handed to the registrars, and the Caixa's Cadastro NIS layout says only "módulo 11". The weights and the remainder rule follow the community references below.
import { isValidCertidao } from '@brazilian-utils/brazilian-utils';

isValidCertidao('104539 01 55 2013 1 00012 021 0000123 21'); // true
isValidCertidao('09430001552010100020112000012087'); // true
isValidCertidao('104539 01 55 2013 1 00012 021 0000123 22'); // false (invalid check digits)
isValidCertidao('09400301542011100110002005191744'); // false (serviço is not 55)
isValidCertidao('10453901552013900012021000012398'); // true (book code 9, Provimento CNJ nº 3/2009)
isValidCertidao('10453901552013000012021000012387'); // false (book code 0 names no book)
isValidCertidao('123456'); // false (wrong length)
isValidCertidao('104539 01 55 2013 1 00012 021 0000123 21', { accept: ['birth'] }); // true
isValidCertidao('104539 01 55 2013 1 00012 021 0000123 21', { accept: ['death'] }); // false

Source: art. 473 of the Código Nacional de Normas da Corregedoria Nacional de Justiça; check digits per ghiorzi.org and validation-br.

Code: brazilian-utils/javascript
Try it with JavaScript isValidCertidao
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 (37) and the result in each library certidao.isValid

Format

Formats the matrícula of a certidão de registro civil into the printed mask of art. 473 of the Código Nacional de Normas. The mask groups the 32 digits as 6 2 2 4 1 5 3 7 2, separated by spaces.

  • The function applies the mask as far as the digits go, so a partial matrícula being typed is masked progressively, and digits beyond the 32nd are dropped. options.pad left-pads with zeros to 32 digits first.
  • A full 32-digit matrícula does not fit an integer, so you must give it as a string.
  • 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 even with options.pad. Until 2.4.0 it returned the full zero mask.
  • options.pad defaults to false.
ParameterTypeRequired
valuestring | numberyes
optionsFormatCertidaoOptionsno
options.padbooleanno
returnsstring

Format the matrícula of a certidão de registro civil into the printed mask of art. 473. The 32 digits are grouped as 6 2 2 4 1 5 3 7 2 and separated by spaces.

  • Options (FormatCertidaoOptions): pad left-pads the value with zeros up to 32 digits (default false). An empty value, or one without digits, gives '' even with pad.
  • A number is accepted when it is a non-negative safe integer, so a full 32-digit matrícula has to be a string. Any other number returns ''.
import { formatCertidao } from '@brazilian-utils/brazilian-utils';

formatCertidao('10453901552013100012021000012321'); // '104539 01 55 2013 1 00012 021 0000123 21'
formatCertidao('104539.01.55.2013.1.00012.021.0000123-21'); // '104539 01 55 2013 1 00012 021 0000123 21'
formatCertidao('1552010100020112000012087', { pad: true }); // '000000 01 55 2010 1 00020 112 0000120 87'
formatCertidao(104539015520); // '104539 01 55 20' (a number is read as the string of its digits)
formatCertidao(1045390155.2); // '' (not a non-negative safe integer)

Source: art. 473 of the Código Nacional de Normas.

Code: brazilian-utils/javascript
Try it with JavaScript formatCertidao
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 (13) and the result in each library certidao.format

Parse

Removes the formatting of a certidão matrícula and keeps only digits, capped at 32 digits.

  • A value shorter than 32 digits passes through as far as it goes, so the mask of an input still being typed can be stripped. Nothing is padded.
  • 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).
ParameterTypeRequired
valuestring | numberyes
returnsstring

Remove the formatting of the matrícula of a certidão de registro civil, keep only digits, and cap the result to 32 digits.

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

parseCertidao('104539 01 55 2013 1 00012 021 0000123 21');
// '10453901552013100012021000012321'
Code: brazilian-utils/javascript
Try it with JavaScript parseCertidao
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 (8) and the result in each library certidao.parse

Decode

Parses the matrícula of a certidão de registro civil into its fields. Returns null when it is not valid (same rules as certidao.isValid).

  • type is the English name of the book (birth, marriage, religious-marriage, death, stillbirth, banns, other, emancipation, interdiction). Fields: CNS of the serventia (6 digits), acervo, service (always 55), year, book type (birth, marriage, religious marriage, death, stillbirth, banns, other, emancipation, interdiction) and its raw code 1 to 9, book, page, term and the 2 check digits.
  • year and typeCode are numbers. registryCns, acervo, service, book, page, term and checkDigits are strings that keep their leading zeros. The input is read like certidao.isValid reads it, so a masked value works and a non-string returns null.
  • Art. 473 V of the Código Nacional de Normas lists book codes 1 to 7. Codes 8 (emancipação) and 9 (interdição) come from Provimento CNJ 3/2009, art. 7º V. That provimento was revoked by Provimento CNJ 63/2017, but certidões issued under it from 2010 carry those codes and are still valid, so both are read, as in 2.4.0.
  • acervo is 01 for the serventia's own acervo and 02 and up for each acervo it absorbed. Art. 473, §§ 3º to 5º split the absorbed ones by the date the origin serventia was extinguished or deactivated. Up to 31/12/2009 the CNS is the incorporating unit's and the acervo code runs from 02, one per incorporation. From 01/01/2010 the CNS is the incorporated unit's own and the code is 01, counted as that unit's own acervo. An acervo split between two or more successor serventias gets each successor's CNS with the code 02.
ParameterTypeRequired
valuestringyes
returnsCertidaoInfo | null

Parse the matrícula of a certidão de registro civil into its fields. Accepts the same input forms as isValidCertidao and returns null when the matrícula is not valid.

  • Returns null also for a serviço other than 55 and for the book code 0.
  • Art. 473, V lists the book codes 1 to 7, from "1: Livro A (Nascimento)" to "7: Livro E (Demais atos relativos ao registro civil)". The codes 8 (emancipação) and 9 (interdição) of the Provimento CNJ nº 3/2009, art. 7º, revoked by the Provimento CNJ nº 63/2017, are not in it but are still read, as "emancipation" and "interdiction", since the certidões issued under it from 2010 on carry them and remain valid documents.

The CertidaoInfo result carries:

KeyDescription
registryCnsThe 6 digit CNS (Código Nacional de Serventia) of the serventia that issued the act.
acervoAcervo the book belongs to: "01" the serventia's own, "02" and up one per acervo it absorbed. Art. 473, §§ 3º to 5º splits the absorbed ones by the date the origin serventia was extinguished or deactivated. Up to 31/12/2009: the CNS of the incorporating unit and an acervo code from "02" up, one per incorporation. From 01/01/2010 on: the CNS of the incorporated unit itself and the code "01", counted as that unit's own acervo. An acervo split between two or more successor serventias gets each successor's own CNS with the code "02".
serviceService rendered by the serventia, always "55", the registro civil das pessoas naturais.
yearFour digit year the act was recorded.
typeThe book the act belongs to: "birth", "marriage", "religious-marriage", "death", "stillbirth", "banns", "other", or, for the codes 8 and 9 of the Provimento CNJ nº 3/2009, "emancipation" and "interdiction".
typeCodeRaw book code, 1 to 9, as printed in the fifteenth position of the matrícula.
bookThe 5 digit book (livro) number, zero padded.
pageThe 3 digit page (folha) number, zero padded.
termThe 7 digit term (termo) number, zero padded.
checkDigitsThe 2 modulus 11 check digits of the matrícula.
import { getCertidaoInfo } from '@brazilian-utils/brazilian-utils';

getCertidaoInfo('104539 01 55 2013 1 00012 021 0000123 21');
// {
//   registryCns: '104539',
//   acervo: '01',
//   service: '55',
//   year: 2013,
//   type: 'birth',
//   typeCode: 1,
//   book: '00012',
//   page: '021',
//   term: '0000123',
//   checkDigits: '21'
// }

getCertidaoInfo('invalid'); // null

Source: art. 473 of the Código Nacional de Normas da Corregedoria Nacional de Justiça; book codes 8 and 9 per the revoked Provimento CNJ nº 3/2009, art. 7º, still listed by ghiorzi.org and validation-br.

Code: brazilian-utils/javascript
Try it with JavaScript getCertidaoInfo
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 (10) and the result in each library certidao.getInfo

Official sources

Last updated on

On this page