Skip to content

Getting started

Datafaker is a library for Java and Kotlin to generate fake data. This can be very helpful when generating test data to fill a database, to generate data for a stress test, or anonymize data from production services.


The latest version of Datafaker is 2.3.1 and is hosted on Maven Central.

Datafaker can be included in your project using most dependency management tools:

dependencies {
    implementation 'net.datafaker:datafaker:2.3.1'
dependencies {
<dependency org="net.datafaker" name="datafaker" rev="2.3.1"/>

Snapshot versions

It's also possible to use the latest snapshot version (currently 2.3-2-SNAPSHOT) by including the Sonatype snapshot repository in your configuration.

A Gradle example can be found below:

repositories {
    maven(url = "")

dependencies {


To use Datafaker to generate fake data, you can use the following code as an example:

import net.datafaker.Faker;

Faker faker = new Faker();

String name =; // Miss Samanta Schmidt
String firstName =; // Emory
String lastName =; // Barton

String streetAddress = faker.address().streetAddress(); // 60018 Sawayn Brooks Suite 449
import net.datafaker.Faker

val faker = Faker()

val name = // Miss Samanta Schmidt
val firstName = // Emory
val lastName = // Barton

val streetAddress = faker.address().streetAddress() // 60018 Sawayn Brooks Suite 449

For a full list of all the fake data providers, have a look at the reference documentation.

Back to top