npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

full-name-generator

v1.1.0

Published

Generate random names using data from popular names and surnames of various countries.

Readme

Full Name Generator - Generate Random Names

npm-version npm-downloads license

Generate random names using authentic data sourced from government statistical offices across 25 countries, including popular first names and surnames from official national datasets.

IMPORTANT: This library's code is MIT licensed, but the name data requires attribution under various government open data licenses. See License & Attribution for details.

Installation

$ npm install full-name-generator --save

Usage

By default, this package includes a lite version with 15 names/surnames per gender per country for smaller bundle sizes. If you need access to the complete dataset, see Full Version below.

import { firstName, lastName, fullName, Gender } from 'full-name-generator';

// Generate Full Names
const maleFullName = fullName('US', Gender.Male);
const femaleFullName = fullName('US', Gender.Female);

// Generate First Names
const maleFirstName = firstName('US', Gender.Male);
const femaleFirstName = firstName('US', Gender.Female);

// Generate Surnames
const turkishSurname = lastName('TR');
const czechFemaleSurname = lastName('CZ', Gender.Female);

// Generate Multiple Names
const twoAmericanMaleFirstNames = firstName('US', Gender.Male, 2);
const twoAmericanLastNames = lastName('US', undefined, 2);
const twoAmericanNamesThreeSurnamesFemaleFullName = fullName('US', Gender.Female, 2, 3);

// Custom separator
const hyphenatedName = fullName('US', Gender.Male, 1, 1, '-');

Full Version

If you need access to the complete dataset with all names and surnames:

import { firstName, lastName, fullName, Gender } from 'full-name-generator/full';

const name = fullName('US', Gender.Male);

Countries

  • 🇦🇷 Argentina (AR)
  • 🇧🇪 Belgium (BE)
  • 🇧🇷 Brazil (BR)
  • 🇨🇿 Czechia (CZ)
  • 🇩🇰 Denmark (DK)
  • 🇫🇮 Finland (FI)
  • 🇫🇷 France (FR)
  • 🇮🇸 Iceland (IS)
  • 🇮🇪 Ireland (IE)
  • 🇮🇱 Israel (IL)
  • 🇮🇹 Italy (IT)
  • 🇱🇻 Latvia (LV)
  • 🇰🇿 Kazakhstan (KZ)
  • 🇲🇽 Mexico (MX)
  • 🇳🇿 New Zealand (NZ)
  • 🇳🇴 Norway (NO)
  • 🇵🇱 Poland (PL)
  • 🇸🇮 Slovenia (SI)
  • 🇰🇷 South Korea (KR)
  • 🇪🇸 Spain (ES)
  • 🇸🇪 Sweden (SE)
  • 🇹🇼 Taiwan (TW)
  • 🇹🇷 Türkiye (TR)
  • 🇬🇧 United Kingdom (GB)
  • 🇺🇸 United States (US)

API Reference

Gender Enum

enum Gender {
  Male = 0,
  Female = 1
}

fullName()

Generates a full name based on the provided parameters.

fullName(isoCode: string, gender: Gender, firstN?: number, lastN?: number, space?: string): string

Parameters:

  • isoCode: The ISO code for the country (e.g., 'BR', 'CZ', 'US'). Case-insensitive.
  • gender: Gender category for the name. Use Gender.Male or Gender.Female (or numeric values 0/1).
  • firstN: Number of first names to be generated (default: 1).
  • lastN: Number of surnames to be generated (default: 1).
  • space: Separator between the first names and surnames (default: ' ').

Returns: A randomly generated full name as a string.

firstName()

Generates one or more first names based on the provided country code and gender.

firstName(isoCode: string, gender: Gender, n?: number): string

Parameters:

  • isoCode: The ISO code for the country (e.g., 'BR', 'CZ', 'US'). Case-insensitive.
  • gender: Gender category for the name. Use Gender.Male or Gender.Female (or numeric values 0/1).
  • n: Number of first names to generate (default: 1).

Returns: A randomly generated first name (or multiple names separated by spaces).

lastName()

Generates one or more surnames. For some countries like Czechia, Iceland, Latvia, and Poland, gender is considered.

lastName(isoCode: string, gender?: Gender, n?: number): string

Parameters:

  • isoCode: The ISO code for the country (e.g., 'BR', 'CZ', 'US'). Case-insensitive.
  • gender: (Optional) Gender category for the surname. Required for countries like Czechia, Iceland, Latvia, and Poland. Use Gender.Male or Gender.Female (or numeric values 0/1).
  • n: Number of surnames to generate (default: 1).

Returns: A randomly generated surname (or multiple surnames separated by spaces).

License

This library has a dual licensing structure:

1. Code License

The source code implementation (TypeScript/JavaScript functions, logic, and types) is licensed under the MIT License.

2. Data License

The name and surname datasets embedded in this package are sourced from government statistical offices under various open data licenses.

IMPORTANT: When you use this package, you are using a combined work and must comply with BOTH the code license (MIT) and the applicable data licenses.

REQUIREMENT: Most countries require you to provide attribution to the original data sources. Failure to comply may violate the data licenses.

Required Attribution

Below are the data sources and their respective licenses:

If you find this library helpful, linking back to us is also appreciated but not required:


For specific dataset URLs, refer to the header comments in src/names/{country}.ts and src/surnames/{country}.ts files in the names and surnames folders.