SEFAZ Brasil icon

SEFAZ Brasil

Brazil Electronic Invoice - CPF/CNPJ validation, Dollar, SELIC, IPCA

Actions12

CPF/CNPJ → Clean

AI-generated

Summary

Remove all non-numeric characters from a given Brazilian CPF or CNPJ document string.

Inputs

  • Document (required) — String containing the CPF or CNPJ document possibly with formatting such as dots, dashes, or slashes.

Output shape

a single object containing the cleaned document string as 'documento' attribute, composed only of numeric characters.

The output JSON has one key 'documento' which holds the numeric-only cleaned document. No validation or formatting is applied beyond character removal.

Examples

Example 1: Input CPF formatted with dots and dashes

Document: '123.456.789-09' => Output: { documento: '12345678909' }

Example 2: Input CNPJ formatted with dots, slash and dash

Document: '11.222.333/0001-81' => Output: { documento: '11222333000181' }

Links

Discussion