# How to infer gender from a name: methods, accuracy and pitfalls

Plain-Markdown twin of <https://gender-api.com/en/infer-gender-from-names>.
Last reviewed 2026-12-05.

A first name says a lot about gender and nothing for certain. This guide covers the four
ways to turn one into the other, how to find out how often each is wrong on your own
names, and the cases that catch everybody out.

## The short answer

- Look the name up in **counted records for the country the person lives in**. You get a
  gender, a probability and a sample count — Andrea is male in Italy and
  female in Germany.
- Judge any method by what it does with a name it does not know. An honest "unknown" can
  be filtered; a confident guess cannot be spotted.
- Measure accuracy on a few hundred of your own names, and score **right, wrong and no
  answer** separately. Then pick the probability cut-off that leaves an error rate you can
  live with.
- Use the result for counts and salutations, not for decisions about a person. It
  describes the name, not the person carrying it.

## Four ways to infer gender from a name

| Method | What comes back for "Andrea" | For a name it has never seen |
|---|---|---|
| A fixed name list (offline dictionary) | one label, nothing to set a cut-off on | `unknown` |
| A model trained on spellings | a label and a model score (not a count of anything) | still a label, from the letters alone |
| A language model (LLM) | a sentence, worded differently each run | a plausible answer that can change between runs |
| Counted records per country (how Gender-API answers) | per country: gender, probability, sample count — e.g. IT male 0.95 with 1,068 samples, DE female 1.00 with 871 (example response) | a low sample count, or `result_found: false` and no credit charged |

The LLM trade-off is covered in detail in
[Gender-API vs. ChatGPT](https://gender-api.com/en/compare/gender-api-vs-chatgpt).

## Why the country changes the answer

Andrea is a man's name in Italy and a woman's name in Germany; Nicola is male in Italy and
female in Britain. A method that gives one answer per name worldwide is wrong for one of
those countries every time, and the error looks like a confident label. Send the country
whenever you know it (address, shipping country, phone prefix, institution); a browser
locale or IP address is a reasonable stand-in. Keep the person's country apart from the
name's origin.

## How to measure accuracy on your own names

1. Take a few hundred names from your own data whose gender you can confirm by hand —
   include the ones you expect to be hard.
2. Run them through every method on your shortlist, with the country where you have it.
3. Score three outcomes, not two: right, wrong, and no answer. A method that always
   answers never shows a "no answer" — its doubtful cases are spread over right and wrong.
4. Raise the probability cut-off step by step and watch wrong answers turn into "held
   back". Stop where the remaining errors are acceptable for the job.
5. Write down the cut-off, the share left unknown and the error rate together.

**Worked example.** A sports-physiology researcher, asked by journal reviewers to justify
using Gender-API for an authorship study, checked 499 author names from the *Journal of
Applied Physiology* by hand (J. Hagberg, 27 February 2025,
[report as PDF](https://gender-api.com/pdf/blog/2025-03-30/Gender%20API%20Validation.pdf)):

| | No answer | Right | Held back | Wrong |
|---|---|---|---|---|
| Take every answer | 11 | 466 | — | 22 (4.5% of the 488 answered) |
| Only answers with probability ≥ 0.80 | 11 | 435 | 46 | 7 (1.4% of the 488 answered) |

Read those numbers for the method, not as an accuracy figure: one person, one set of
mostly uncommon names, not a benchmark. Gender-API publishes no accuracy figure of its own —
[How to choose a gender API](https://gender-api.com/en/compare/how-to-choose-a-gender-api)
explains why.

## The pitfalls

| Pitfall | What goes wrong | What to do |
|---|---|---|
| Unisex names | Kim, Jordan or Andrea get a label either way | Send the country; leave what stays near 50/50 unknown |
| Family name first | In Chinese, Japanese, Korean or Hungarian order the first word is the surname | Use a full-name lookup that [finds the first name](https://gender-api.com/en/split-first-and-last-name) |
| Initials and titles | "J. Smith" has no first name; "Dr" is not one | Strip titles; count initials as unknown, not as errors |
| Thin evidence | A confident probability can rest on a handful of records | Set a minimum sample count next to the probability cut-off |
| Not a name at all | Company names, "info@" addresses and test rows reach the lookup | Prefer a method that says "not found" over one that always answers |
| Only an e-mail address | "jsmith84@" hides the name; "julia.smith@" does not | Use an e-mail lookup that extracts the name; expect more unknowns |

## What a name cannot tell you

An inferred gender is a statement about a name, not about the person in a given row, and
it cannot represent anyone who is neither a man nor a woman.

- Use it for aggregates — authorship studies, pay-gap and diversity reporting, audience
  analysis — where individual errors average out and the error rate can be stated.
- Use it for salutations with a neutral fallback below your cut-off.
- Do not use it to decide anything about an individual — a price, an offer, an
  application.
- Where it matters, ask people. A self-stated gender always overrides an inferred one.

Names are personal data. Gender-API is a German company, servers are in Germany,
processing happens inside the EU, and a data-processing agreement can be requested in the
account.

## What to write in the methods section

1. The method or service, and the date of the lookups.
2. Whether a country was sent with each name, and where it came from.
3. The probability cut-off and the minimum sample count.
4. The share of names left unknown, and whether they were dropped or reported as a group.
5. How the error rate was checked: sample size, labelling, right/wrong/unknown counts.

Every Gender-API result carries the probability and the sample count. For a list, see
[bulk gender lookup](https://gender-api.com/en/bulk-gender-lookup); for a pipeline,
[gender from names in Python](https://gender-api.com/gender-from-name-python.md).
