SSN Generator & Validator

SSN Generator & Validator

Generate and validate SSN (USA), CPF (Brazil), NIF (Portugal), DNI (Spain), Codice Fiscale (Italy), Steuer-IdNr (Germany) and NIR (France) for dev testing.

Updated May 2026

Generator

SSN

--

Validator

Validation Report

Waiting for input…

Free SSN Generator & Validator — Fake Social Security Numbers for Dev Testing

Generate structurally valid US Social Security Numbers (SSN) for form testing, API integration, and QA workflows — every number respects the official SSA format rules (valid area, group, and serial ranges) without a real person behind it. The tool also generates tax IDs for Brazil (CPF), Portugal (NIF), Spain (DNI), Italy (Codice Fiscale), Germany (Steuer-IdNr), and France (NIR) in the same interface.

The built-in validator lets you paste any SSN and instantly check whether it is structurally valid — confirming the area code is not 000 or 666, the group is not 00, the serial is not 0000, and no forbidden range applies. For other countries, the validator runs the full check-digit algorithm with a detailed error breakdown.

How to Use the SSN Generator

Generating a valid SSN takes three seconds:

  1. Select United States — Click the US flag tab at the top. The tool switches to SSA format rules. SSN is the default for English pages.
  2. Configure options — Toggle "Formatted" to switch between hyphenated format (078-05-1120) and plain digits (078051120). Select quantity (1 to 100) for batch generation.
  3. Click Generate — A new valid SSN appears instantly. Click the copy icon or press Shift+Enter to copy to clipboard. For batches, export directly to CSV or JSON.

To validate an existing SSN, switch to the Validate tab, paste the number, and the result appears immediately with the specific rule violation if invalid.

How the SSN Is Structured

The Social Security Number has 9 digits divided into three parts:

078-05-1120
│││  ││  ││││
│││  ││  └──── Serial number (0001–9999)
│││  └──────── Group number (01–99)
└──────────────── Area number (001–899)

Area number (first 3 digits): Cannot be 000, 666, or anything in the 900–999 range. Since the SSA randomized SSN assignment in June 2011, area numbers no longer correspond to specific US states.

Group number (middle 2 digits): Cannot be 00.

Serial number (last 4 digits): Cannot be 0000.

No mathematical check digit: Unlike CPF (Brazil), NIF (Portugal), or Steuer-IdNr (Germany), the SSN has no check digit computed from the other digits. Validation is entirely structural — confirming the three fields fall within their allowed ranges.

Reserved numbers: The SSN 078-05-1120 is permanently reserved — it appeared in a 1938 Woolworth wallet advertisement and was mistakenly used as a real SSN by over 40,000 people. Any generated SSN from this tool avoids this and all other known reserved numbers.

SSN and Tax ID Examples by Country

Country Document Formatted example Unformatted
🇺🇸 USA SSN 078-05-1120 078051120
🇧🇷 Brazil CPF 123.456.789-09 12345678909
🇵🇹 Portugal NIF 123 456 789 123456789
🇪🇸 Spain DNI 12345678-Z 12345678Z
🇮🇹 Italy Codice Fiscale RSSMRA80A01H501U same
🇩🇪 Germany Steuer-IdNr 86 095 742 719 86095742719
🇫🇷 France NIR 1 80 02 75 056 018 15 180027505601815

Edge case — area 000: 000-05-1120 is invalid because the area is 000. Use it to test your form's error path for invalid SSN input.

Edge case — area 666: 666-05-1120 is explicitly excluded by SSA rules. Use to test rejection of the 666 range.

Edge case — serial 0000: 078-05-0000 is invalid. Use to verify your validator catches the zero serial.

How Each Validation Algorithm Works

  • SSN (USA): Structural only — area ≠ 000, area ≠ 666, area not in 900–999, group ≠ 00, serial ≠ 0000. No mathematical check digit.
  • CPF (Brazil): Two check digits via Módulo 11 with descending weights (10→2 and 11→2). All-identical numbers (111.111.111-11 etc.) are invalid by definition.
  • NIF (Portugal): One check digit via Módulo 11 with weights 9→2. First digit encodes contributor type (1–2 = individual, 5 = company, etc.).
  • DNI (Spain): Letter from "TRWAGMYFPDXBNJZSQVHLCKE" at position number mod 23. NIE prefix (X/Y/Z) maps to 0/1/2 before calculation.
  • Codice Fiscale (Italy): Derived from personal data — surname consonants, name consonants, birth year, month letter, birth day (+ 40 for women), municipality Belfiore code. One check character via odd/even position tables. Uniquely decodable back to sex, approximate birth date, and municipality.
  • Steuer-IdNr (Germany): 11 digits — first digit 1–9, no digit more than twice in positions 1–10, no three consecutive identical digits. Check digit via modified Luhn algorithm.
  • NIR (France): 13 structured digits (sex + year + month + département + commune + order) + 2-digit key = 97 − (N mod 97), same algorithm as IBAN check digits.

Common Use Cases

  • US registration form testing: Forms that collect SSN for identity verification (banking, healthcare, tax filing) must validate the format before submitting. Generate structurally valid fake SSNs to test each acceptance and rejection path.
  • HIPAA and PII compliance: Real SSNs are protected PII under US law. Using generated SSNs in development environments is the legally correct approach — real numbers must never appear in logs, test databases, or dev environments.
  • API integration testing: Payment processors, background check APIs, and US tax APIs validate SSN format at the request level. Generated SSNs pass format validation without touching real citizen data.
  • Frontend validation unit tests: Use the batch generator to produce 50 or 100 valid SSNs and feed them into your validation function to verify it accepts all of them. Export to JSON for fixture files.
  • Testing rejection paths: Use 000-00-0000, 666-01-2345, or 900-01-0001 to confirm your validator correctly rejects forbidden ranges.
  • Multi-country platform testing: If your platform handles users from multiple countries, use the same tool to generate SSN (USA), CPF (Brazil), DNI (Spain), and Steuer-IdNr (Germany) in one session.
  • Full persona generation: The identity card shows a complete fictional profile — name, address, email, phone, and SSN — coherent for US-based test fixtures.

Common Mistakes

  • Using real SSNs found online: Real SSNs belong to real people. Using them in development environments violates US law (Privacy Act of 1974) and exposes your organization to significant legal risk. Always generate fictitious SSNs.
  • Confusing "structurally valid" with "real": A generated SSN passes format and range validation but is not registered with the SSA. It cannot be used in real transactions, tax filings, or identity verification.
  • Forgetting to strip hyphens before API calls: Some APIs expect raw digits (078051120) while others accept the hyphenated format (078-05-1120). Use the format toggle to match the expected input.
  • Testing only the happy path: Always test your validator with SSNs that violate specific rules — area 000, area 666, area 900+, group 00, serial 0000. Each should produce a distinct error message.

Frequently Asked Questions

Does the generated SSN belong to a real person?

No. The generator creates numbers that respect SSA structural rules (valid area, group, and serial ranges) but are not assigned to any real person in the SSA database. No generated SSN will return data from any official government or background check service.

Can I use a generated SSN to fill in real forms?

No. Generated SSNs are exclusively for software testing — form validation, API integration, and QA environments. Using them in real applications, tax filings, financial services, or identity verification is a federal crime under US law. They are structural constructs, not identity documents.

Why does the SSN have no check digit?

The SSN predates modern validation design — it was introduced in 1936 primarily as a record-keeping number, not a cryptographically verified identifier. The SSA never added a check digit to the specification. Unlike CPF, NIF, or Steuer-IdNr, validity is determined entirely by whether the three segments fall within allowed ranges.

What changed when SSA randomized SSN assignment in 2011?

Before June 25, 2011, the area number (first 3 digits) corresponded to the state where the SSN was issued. After randomization, new SSNs are assigned randomly from the full valid range — there is no longer a geographic signal in the area number. Previously issued numbers retain their original area codes.

Does this tool work offline?

Yes. All algorithms run entirely in your browser using JavaScript. No number is ever sent to a server. The tool works without an internet connection after the page loads.

What is the difference between SSN, EIN, and ITIN?

The SSN (Social Security Number) identifies US citizens and permanent residents for tax and social security purposes. The EIN (Employer Identification Number) identifies businesses — it has the format XX-XXXXXXX. The ITIN (Individual Taxpayer Identification Number, starting with 9) is for people who need a US tax ID but are not eligible for an SSN. This tool generates and validates SSNs only.

How to Validate CPF in Code

The CPF uses two Módulo 11 check digits. The first is computed from the 9-digit base with descending weights 10→2; the second from the 10-digit base with weights 11→2. All-identical digit sequences (111.111.111-11, etc.) are explicitly invalid under the Receita Federal specification.

Source: Receita Federal — CPF Specification

JavaScript

function validateCPF(input) {
  const cpf = input.replace(/[.\-]/g, '');
  if (cpf.length !== 11 || new Set(cpf).size === 1) return false;

  const check = (len) => {
    let sum = 0;
    for (let i = 0; i < len; i++) sum += parseInt(cpf[i]) * (len + 1 - i);
    const rem = sum % 11;
    return rem < 2 ? 0 : 11 - rem;
  };

  return parseInt(cpf[9]) === check(9) && parseInt(cpf[10]) === check(10);
}

console.log(validateCPF('123.456.789-09')); // true
console.log(validateCPF('111.111.111-11')); // false — all-identical digits
console.log(validateCPF('123.456.789-00')); // false — wrong check digit

Python

import re

def validate_cpf(input_str: str) -> bool:
    cpf = re.sub(r'[.\-]', '', input_str)
    if len(cpf) != 11 or len(set(cpf)) == 1:
        return False

    def check(length: int) -> int:
        total = sum(int(cpf[i]) * (length + 1 - i) for i in range(length))
        rem = total % 11
        return 0 if rem < 2 else 11 - rem

    return int(cpf[9]) == check(9) and int(cpf[10]) == check(10)

print(validate_cpf('123.456.789-09'))  # True
print(validate_cpf('111.111.111-11'))  # False — all-identical digits
print(validate_cpf('123.456.789-00'))  # False — wrong check digit

PHP

function validateCPF(string $input): bool {
    $cpf = preg_replace('/[.\-]/', '', $input);
    if (strlen($cpf) !== 11 || strlen(count_chars($cpf, 3)) === 1) return false;

    $check = function(int $len) use ($cpf): int {
        $sum = 0;
        for ($i = 0; $i < $len; $i++) $sum += (int)$cpf[$i] * ($len + 1 - $i);
        $rem = $sum % 11;
        return $rem < 2 ? 0 : 11 - $rem;
    };

    return (int)$cpf[9] === $check(9) && (int)$cpf[10] === $check(10);
}

var_dump(validateCPF('123.456.789-09')); // bool(true)
var_dump(validateCPF('111.111.111-11')); // bool(false) — all-identical digits
var_dump(validateCPF('123.456.789-00')); // bool(false) — wrong check digit

Resources

Related Tools