Generate invalid-by-design SSN test strings
This tool produces strings that match the exact shape of a US Social Security number so they pass front-end format validation, while guaranteeing they can never be a real SSN. It does this by using area numbers in the 900–999 range, which the Social Security Administration has never issued. The result is safe seed data for forms, masking tests, and validation logic — and is useless to a fraudster.
How it works
A Social Security number has the form AAA-GG-SSSS:
- Area number (AAA) — historically tied to geography. This tool fixes it to 900–999, a block the SSA never assigns, so the number is invalid by construction.
- Group number (GG) —
01–99; never00. The tool picks01–99. - Serial number (SSSS) —
0001–9999; never0000. The tool picks0001–9999.
Because the area number is in the forbidden range, no combination this tool emits can ever equal a real SSN, regardless of the group and serial digits.
Why the 900–999 block is safe
The Social Security Administration assigns area numbers in the range 001–899 (with some gaps). The 900–999 range has historically been used only for Individual Taxpayer Identification Numbers (ITINs), not SSNs. Under the SSA’s randomisation program introduced in 2011, all area numbers 900–999 remain permanently invalid as SSNs. This is not an informal convention — it is a structural guarantee built into SSN issuance policy. Any SSN validator that correctly implements SSA rules will reject a 900-series number without needing to check a database.
What to test with generated SSNs
A batch of generated SSN-format strings is most useful for the following scenarios:
Format validation. Does your front-end accept 900-12-3456 as structurally valid (correct shape) before sending to a backend that performs a deeper check? It should, because format validation should only verify structure, not legitimacy.
Masking and partial reveal. Many UIs show SSNs as XXX-XX-3456 (last four digits only). Testing masking logic needs a value in the right format. Generated values work perfectly here because the masked output is what matters, not the underlying number.
Duplicate detection. If your system prevents duplicate SSNs within a user dataset, generate a batch, insert it, then try inserting duplicates to confirm the constraint fires.
Character filtering. Some forms strip non-digit characters; others store the dashed format. Test both 900123456 and 900-12-3456 to confirm your persistence layer handles both shapes.
Format options
- Dashed (
900-12-3456) — the standard human-readable form, required by many form inputs. - Plain 9 digits (
900123456) — used by systems that store SSNs without punctuation.
Always test both, because a validator that expects exactly \d{3}-\d{2}-\d{4} will reject a plain-digit input even if the underlying number is structurally valid.
Legal and ethical reminder
Generating format strings for software testing is straightforward and legal. Using any SSN-shaped value — real or fictional — to impersonate a person, open financial accounts, or commit identity fraud is a serious federal crime under 18 U.S.C. § 1028. This tool is strictly for development use.