Skip to main content
BR Utils

BR Utils

Format, generate, and validate Brazilian CPF and CNPJ — in the language you already use.

What BR Utils does

Format

Apply or strip CPF and CNPJ masks.

Generate

Generate valid CPF and CNPJ identifiers.

Validate

Check check-digits and format.

Alphanumeric CNPJ

Support for the new alphanumeric CNPJ format (2026).

Unified API

One façade package wrapping CPF and CNPJ utilities.

Configurable defaults

Set instance defaults and override them per call.

The same flow, in every language

import brUtils from 'br-utils'

brUtils.cpf.format('47844241055') // '478.442.410-55'
brUtils.cpf.generate({ format: true })
brUtils.cpf.isValid('123.456.789-09') // true

brUtils.cnpj.format('03603568000195') // '03.603.568/0001-95'
brUtils.cnpj.generate({ format: true })
brUtils.cnpj.isValid('98765432000198') // true

Available now

Four languages ready for production. Java, Go, and Rust are on the way.

In development

Java / Kotlin / ScalaComing soon
GoComing soon
RustComing soon