Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
F

faker

> 编程语言
Open source

Generate massive amounts of fake data in the browser and node.js

15.4K stars0 likes3 views
WebsiteGitHub

About

Generate massive amounts of fake data in the browser and node.js

⚡️ Try it Online

Open in StackBlitz

📙 API Documentation

⚠️ You are reading the docs for the next branch ⚠️

Please proceed to the Getting Started Guide for the stable release of Faker.

For detailed API documentation, please select the version of the documentation you are looking for.

Version Website
v11 (next) https://next.fakerjs.dev/
v10 (stable) https://fakerjs.dev/
v9 (old) https://v9.fakerjs.dev/

🚀 Features

  • 🧍 Person - Generate Names, Genders, Bios, Job titles, and more.
  • 📍 Location - Generate Addresses, Zip Codes, Street Names, States, and Countries!
  • ⏰ Date - Past, present, future, recent, soon... whenever!
  • 💸 Finance - Create stubbed out Account Details, Transactions, and Crypto Addresses.
  • 👠 Commerce - Generate Prices, Product Names, Adjectives, and Descriptions.
  • 👾 Hacker - “Try to reboot the SQL bus, maybe it will bypass the virtual application!”
  • 🔢 Number and String - Of course, we can also generate random numbers and strings.
  • 🌏 Localization - Pick from over 70 locales to generate realistic looking Names, Addresses, and Phone Numbers.

Note: Faker tries to generate realistic data and not obvious fake data. The generated names, addresses, emails, phone numbers, and/or other data might be coincidentally valid information. Please do not send any of your messages/calls to them from your test setup.

📦 Install

bash
npm install --save-dev @faker-js/faker

🪄 Usage

typescript
// ESM
import { faker } from '@faker-js/faker';

// CJS
const { faker } = require('@faker-js/faker');

export function createRandomUser() {
  return {
    userId: faker.string.uuid(),
    username: faker.internet.username(),
    email: faker.internet.email(),
    avatar: faker.image.avatar(),
    password: faker.internet.password(),
    birthdate: faker.date.birthdate(),
    registeredAt: faker.date.past(),
  };
}

export const users = faker.helpers.multiple(createRandomUser, {
  count: 5,
});

💎 Modules

An in-depth overview of the API methods is available in the documentation for v10 (stable) and v11 (next).

Templates

Faker contains a generator method faker.helpers.fake for combining faker API methods using a mustache string format.

typescript
console.log(
  faker.helpers.fake(
    'Hello {{person.prefix}} {{person.lastName}}, how are you today?'
  )
);

🌏 Localization

Faker has support for multiple locales.

The main faker instance uses the English locale. But you can also import instances using other locales.

typescript
// ESM
import { fakerDE as faker } from '@faker-js/faker';

// CJS
const { fakerDE: faker } = require('@faker-js/faker');

See our documentation for a list of provided languages.

Please note: Not every locale provides data for every module. In our pre-made faker instances, we fall back to English in such a case as this is the most complete and most commonly used language. If you don't want that or prefer a different fallback, you can also build your own instances.

typescript
import { de, de_CH, Faker } from '@faker-js/faker';

export const faker = new Faker({
  locale: [de_CH, de],
});

⚙️ Setting a randomness seed

If you want consistent results, you can set your own seed. If you are using faker.date methods, there are additional considerations. See Reproducible Results.

typescript
faker.seed(123);

const firstRandom = faker.number.int();

// Setting the seed again resets the sequence.
faker.seed(123);

const secondRandom = faker.number.int();

console.log(firstRandom === secondRandom);

🤝 Sponsors

Faker is an MIT-licensed open source project with its ongoing development made possible entirely by the support of these awesome backers

Sponsors

Backers

✨ Contributing

Please make sure to read the Contributing Guide before making a pull request.

📘 Credits

Thanks to all the people who already contributed to Faker!

The fakerjs.dev website is generously hosted by Netlify, with search functionality powered by Algolia.

📝 Changelog

Detailed changes for each release are documented in the release notes.

📜 What happened to the original faker.js?

Read the team update (January 14th, 2022).

🔑 License

MIT

Issues· 94 open

View all issuesOpen on GitHub
  • #385

    Dependency Dashboard

    c: dependenciesUpdated Oct 1, 2026
  • #4021

    Use oxlint to detect other places where functions throw but don't have a throws JSDoc

    c: docsp: 1-normalUpdated Sep 14, 2026
  • #4095

    Support custom country calling code in phone.number()

    questionp: 1-normalUpdated Sep 13, 2026
  • #4092

    Merge code paths for example to executable

    c: docss: on holdp: 1-normalc: testc: infraUpdated Sep 13, 2026
  • #1749

    Run seeded tests for all locales

    p: 1-normalc: tests: acceptedUpdated Sep 6, 2026
  • #1118

    Export individual API modules on their own

    c: featurep: 1-normals: acceptedUpdated Sep 3, 2026
  • #181

    Credit Card number parameter

    c: docshelp wantedp: 1-normals: needs decisionm: financeUpdated Aug 23, 2026
  • #4008

    docs(image): incorrectly typed example in personPortrait

    c: docsp: 1-normalm: imageUpdated Aug 22, 2026
  • #3494

    Add faker.location.neighborhood() helper for Brazilian “bairro”

    c: featurep: 1-normals: acceptedm: locationUpdated Aug 22, 2026
  • #3867

    Design Consideration: Standalone Module Function this parameter

    questionp: 1-normals: needs decisionc: refactorUpdated Aug 15, 2026

> Tags

TypeScriptbrowserdatafakefaker

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言