TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    Brazilian Gender predict

    TypeScript License: MIT

    While I was searching for a NodeJS library that could predict a person gender by its name, I've come across this blog:

    So it gave me the idea I need to build up my own lib, since I didn't find anything similar in npm.

    Original library has a lot of options that don't suit my project, so I didn't write them down. Maybe one day.

    Getting Started

    You can install the package via npm or yarn

    npm install br-gender
    yarn add br-gender


    Usage is pretty straightforward. Import getGenderByName from package and pass a name to it.

    import { getGenderByName } from 'br-gender';
    const gender = await getGenderByName('Thiago');
    // OUTPUT: 'Male'

    You can also pass a boolean property to get back the percentual of gender over every entry:

    import { getGenderByName } from 'br-gender';
    const gender = await getGenderByName('Thiago', { percentage: true });
    // OUTPUT: { gender: 'Male', percentage: 99.30}

    How it works under the hood

    Basically, it searches the brazilian census API with the given name and sum all occurrences from both genders, male and female. For example, if the given name is 'Thiago', it will perform a search from both genders and sum them. If the male percentage is greater than 95% over the total, so the gender of the name should be male.

    I know it isn't perfect, but it suited my project back in the day.


    • Thiago Vasconcellos - Initial work - brzipcode


    This project is licensed under the MIT License - see the file for details



    npm i br-gender

    DownloadsWeekly Downloads






    Unpacked Size

    29.7 kB

    Total Files


    Last publish


    • avatar