Validate Brazilian documents in your language.

CPF, CNPJ, CEP, license plates and 48 more. A library for JavaScript, Python, Go, Ruby, Rust, .NET, and Erlang, all checked against the same 5,049 shared test cases.

CPFnot valid

The right check digits would be 31.

Examples:
This field in your project, in React, Angular, Vue, and Vanilla

The same call, in your language

Each library names its functions the way its language expects. Pick yours once: every page of this site opens on it.

npm install @brazilian-utils/brazilian-utils
import { isValidCpf } from '@brazilian-utils/brazilian-utils';

isValidCpf('155151475'); // false
isValidCpf('111 444 777 35'); // true (whitespace mask)

180 of 182 contract functionsJavaScript library

How every library gives the same answer

A function is defined once, and every library is held to that definition, in its own language and on its own schedule.

  1. The contract

    Each function, its signature and its test cases are written once, in JSON, in the docs repository.

  2. An issue per gap

    A library that lacks a function, or fails a case, gets an issue with the reference code.

  3. The same tests

    Every library runs the shared cases in its own test suite, on every change.

  4. This site

    Built from the contract and the latest run: what each library has and how to call each function.

Every utility

Under each utility, the libraries that have it. Hover over or tap the line to see each library.

Personal documents

Companies

Tax documents

Products

Finance

Address

Phone and email

Vehicles

Courts

Text and dates