Generate and validate Brazilian CPF numbers in your browser.
Pin the digits you care about and it fills the rest at random, with valid check digits. For testing forms and systems that require a CPF, without using a real one.
English · Português
Features · Getting started · Scripts · FAQ · Disclaimer
Generates and validates Brazilian CPF numbers, right in your browser. Pin any digits you care about and it fills the rest randomly, computing valid check digits automatically. Handy for testing forms and systems that require a CPF without using a real one.
- CPF generator: fill in only the digits you want fixed, leave the rest blank for random ones
- Automatic check digits: the two verification digits are always computed correctly (standard CPF algorithm, mod 11)
- CPF validator: paste a CPF and instantly see if it's mathematically valid
- Copy to clipboard: one click to copy the generated CPF, formatted (
000.000.000-00) - Fully random mode: generate a valid CPF with no fixed digits at all
- 100% client-side: nothing is sent to a server
- React 18 + TypeScript
- Vite 5
- Tailwind CSS
- lucide-react (icons)
Try it without installing anything at custom-cpf.vercel.app.
To run it locally:
git clone https://github.com/obrenoalvim/custom-cpf.git
cd custom-cpf
npm install
npm run devOpen http://localhost:5173.
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Production build |
npm run preview |
Preview the production build |
npm run lint |
Run ESLint |
npm run test |
Run the test suite (Vitest) |
This generator exists for educational purposes and system testing only. Do not use generated CPFs for fraudulent or illegal purposes.
Does the validator check a CPF against a government database? No. It checks only the two check digits, so it tells you whether a number is mathematically valid, not whether it is registered to a person.
Can I fix some digits and randomize the rest? Yes. Fill in the digits you want fixed, leave the others blank, and the generator fills them in and computes both check digits.
Is anything sent to a server? No. Everything runs in your browser.
Is a generated CPF safe to use as test data? The number is random with valid check digits, so a generated CPF may happen to belong to a real person. Use it only as test data and never as an identity.
- diff-viewer: compare two pieces of text and see what changed, in your browser.
- pdf-metadata-editor: edit a PDF's title, author and other details in your browser.
- status-hub: one grid for every status page you check.
See CONTRIBUTING.md and the changelog.
If this saved you from typing fake CPFs by hand, a ⭐ helps other developers find it.
Topics: cpf · cpf-generator · cpf-validator · gerador-cpf · brazil · generator · validator · testing-tools · client-side · react · typescript