Home
Safe Sample SSN Numbers for Software Testing and System Validation
In software engineering, database management, and cybersecurity testing, developers frequently encounter a critical challenge: validating systems that process U.S. Social Security Numbers (SSNs) without exposing actual Personally Identifiable Information (PII). Using a real individual's SSN in a development or staging environment is not merely a security oversight; it is a significant legal liability that can lead to severe federal penalties and data breaches.
The solution lies in the strategic use of sample SSN numbers. These are structured digits that adhere to the 9-digit format required by validation logic but are intentionally selected from ranges that the Social Security Administration (SSA) has never issued and will never assign to individuals.
Immediate Reference for Safe Sample SSN Numbers
For those requiring immediate test data, the following numbers are categorized as "invalid" by the SSA and are safe for use in documentation, tutorials, and functional testing.
| Sample SSN | Technical Reason for Invalidity | Usage Category |
|---|---|---|
| 000-12-3456 | Area segment cannot be 000 | Boundary testing |
| 666-01-0001 | Area segment 666 is reserved and unassigned | Format validation |
| 921-45-6789 | Area segment in the 900–999 range is unissued | Range validation |
| 123-00-4567 | Group segment (middle 2 digits) cannot be 00 | Middle-segment logic |
| 456-78-0000 | Serial segment (last 4 digits) cannot be 0000 | End-of-string logic |
| 078-05-1120 | Historically famous "advertisement" number | Legacy data cleanup |
The Three-Segment Structure of a Social Security Number
To effectively generate and utilize sample data, one must understand the legacy and modern structure of the SSN. Prior to June 25, 2011, the SSN was a highly structured identifier consisting of three distinct parts: the Area Number, the Group Number, and the Serial Number.
The Area Number (Digits 1-3)
Originally, the first three digits indicated the geographical location of the person’s residence at the time of application. For instance, numbers starting with 001–003 were assigned to residents of New Hampshire. However, because this became a bottleneck for issuance and presented minor privacy concerns, this geographical link was severed in 2011.
In a testing environment, the Area Number is the first line of defense in validation. Any number starting with 000, 666, or ranging from 900 to 999 is considered invalid.
The Group Number (Digits 4-5)
The middle two digits, known as the Group Number, were used for administrative sorting within the SSA. These numbers do not follow a straight chronological order (e.g., 01, 02, 03). Instead, they are issued in a specific sequence (odd numbers 01 through 09, then even numbers 10 through 98, followed by even numbers 02 through 08, and finally odd numbers 11 through 99).
For sample data purposes, any SSN with 00 as the middle segment is strictly invalid. This is a common "edge case" used in unit testing to ensure that validation scripts correctly identify improperly formatted inputs.
The Serial Number (Digits 6-9)
The final four digits are the Serial Number, representing a straight numerical progression from 0001 to 9999 within each group. In any legitimate SSN, this segment cannot be 0000.
When we design load tests for database performance, utilizing the full range of 0001 through 9999 while keeping the Area and Group numbers in the "invalid" range allows for high-volume data simulation without the risk of colliding with real-world identities.
The 2011 Paradigm Shift: SSN Randomization
On June 25, 2011, the Social Security Administration implemented "SSN Randomization." This change significantly impacted how developers must think about sample SSN numbers.
Why Randomization Occurred
The SSA moved to a randomized system to accomplish two goals:
- Extended Longevity: By breaking the geographical and group sequences, the SSA ensured that the 9-digit pool would last significantly longer.
- Identity Protection: It became harder to "guess" or reconstruct an SSN based on a person's birthplace and birth year.
Impact on Validation Logic
For software built before 2011, many systems relied on "High Group Lists" (published monthly by the SSA) to verify if an SSN was "active." Post-randomization, these lists are obsolete for new numbers.
When creating sample SSN numbers today, the most reliable method to ensure a number is "fake" is to use the 900-999 area range, as the SSA explicitly stated that numbers in the 900s are reserved for testing and specific administrative purposes and will not be issued to citizens.
Defining the "Invalid" Criteria for Sample Data
In our experience building financial technology (FinTech) platforms, we categorize "invalid" SSNs into two buckets: Format-Invalid and Issuance-Invalid. Both are necessary for a robust test suite.
Format-Invalid Samples
These are strings that do not follow the basic 9-digit pattern or contain prohibited characters. Testing these ensures your application doesn't crash when a user enters "N/A" or "123-45-678".
12-345-6789(Wrong hyphen placement)12345678(Only 8 digits)123-4A-5678(Alpha characters)000-00-0000(All zeros - a classic placeholder)
Issuance-Invalid Samples (The "Safe" List)
These follow the XXX-XX-XXXX format perfectly but are safe because they fall into the following SSA-defined "voids":
- Area Code 000: Never used.
- Area Code 666: Historically avoided due to cultural sensitivities and never assigned.
- Area Codes 900-999: Reserved exclusively for administrative and testing purposes.
- Group Code 00: The middle segment must be 01-99.
- Serial Code 0000: The last four digits must be 0001-9999.
The Case of 078-05-1120: A Historical Warning
One of the most famous sample SSN numbers is 078-05-1120. In 1938, a wallet manufacturer (E.H. Ferree Co.) wanted to show customers where to put their Social Security cards. They printed a sample card and inserted it into thousands of wallets.
The number used on that card was the actual SSN of a company employee, Hilda Schrader Whitcher. For decades, thousands of people across the United States used this number as their own, leading to a massive data mess for the SSA and the IRS. Even today, systems must be programmed to flag 078-05-1120 as a "dummy" number because it appears in legacy databases so frequently.
This serves as a critical lesson for modern developers: Never use a real number for a demonstration, even if it belongs to you. Always use the 900-series or 000-series samples.
Technical Implementation of SSN Validation
When developing an application, your code should both accept validly formatted SSNs and reject the "impossible" ones described above. Below is a breakdown of how to approach this technically.
Regex for Basic Formatting
A standard Regular Expression (Regex) for a U.S. SSN often looks like this:
^\d{3}-\d{2}-\d{4}$
However, this only checks for the presence of digits and hyphens. A more sophisticated "Sanity Check" regex that excludes the known invalid sample ranges would look like this:
^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$
Breakdown of the Advanced Regex:
^(?!000|666|9\d{2}): This negative lookahead ensures the first three digits are not000,666, or in the900-999range.(?!00)\d{2}: Ensures the middle two digits are not00.(?!0000)\d{4}: Ensures the last four digits are not0000.
Database Storage Considerations
When storing sample SSN numbers or real SSNs, the data type choice is vital.
- Avoid Integer types: An SSN starting with
0(like those in New York or Massachusetts) will lose the leading zero if stored as a number (e.g.,012345678becomes12345678). - Recommended Type:
CHAR(9)orVARCHAR(11)if you are including hyphens. In our production environments, we prefer storing the raw 9 digits (CHAR(9)) to save space and adding the hyphens at the UI/UX layer.
Best Practices for Data Masking and Anonymization
If you are working with a production database that needs to be copied into a testing environment, you cannot simply copy the real SSNs. You must apply data masking or use synthetic data generation.
Static Data Masking
This involves permanently replacing the real SSN with a sample SSN number in the test database. A common technique is to overwrite the first five digits with "X" (e.g., XXX-XX-1234). While this is good for display, it fails functional testing that requires a full 9-digit valid-looking number.
Synthetic Data Generation
Instead of masking, many modern DevOps pipelines use tools to generate entirely synthetic datasets. By using the rules mentioned earlier (Range 900-999), you can generate millions of unique, non-colliding sample SSNs that allow for realistic performance testing of indexing and search algorithms without ever touching real user data.
Why Using Real SSNs for Testing is Dangerous
The temptation to use "real-looking" data often stems from a desire to ensure the system handles edge cases correctly. However, the risks far outweigh the benefits.
Legal Risks
Under the Privacy Act of 1974 and modern regulations like the California Consumer Privacy Act (CCPA) and HIPAA (for healthcare data), SSNs are classified as sensitive PII. Unauthorized access or disclosure—even to an internal developer who doesn't have a "business need to know"—can result in fines exceeding $50,000 per violation.
Security Risks
Development and staging environments are rarely as secure as production. They often have weaker firewall rules, more permissive user access, and less rigorous logging. If a developer uses a real SSN in these environments, that PII is now "in the wild" for anyone with access to the dev logs or database backups.
Ethical Implications
As technical professionals, we hold a position of trust. Using a real person's identity as a "test subject" is a violation of professional ethics. Using sample SSN numbers demonstrates a commitment to "Privacy by Design."
Strategies for QA Teams and Automation
Quality Assurance (QA) teams need a variety of sample SSN numbers to ensure the system is resilient. When creating a test plan, include the following scenarios:
- Valid Format/Invalid Issuance: Use
910-12-3456. The system should accept the format but may (depending on the business logic) flag it as a "Non-Issuable" number. - Boundary Testing: Test the smallest possible "valid" number (
001-01-0001) and the largest possible pre-2011 "valid" number (772-99-9999). - Null and Empty Strings: Ensure the database handles missing SSN fields gracefully without throwing a
NullPointerException. - Duplicate Entries: Use a specific sample SSN number (like
900-00-0001) twice to test your system's unique constraint logic and error messaging.
Conclusion
The use of sample SSN numbers is a fundamental requirement for responsible software development. By utilizing the designated invalid ranges—specifically those starting with 000, 666, or the 900-series—developers can build and test robust systems that respect user privacy and comply with federal regulations.
Remember that the goal of testing is to validate the logic of the system, not the validity of the identity. By adhering to the SSA’s issuance rules and implementing strict data masking policies, you protect both your users and your organization from the catastrophic consequences of identity theft.
Frequently Asked Questions
Can I use my own SSN for testing if it's my own code?
No. Even if it is your own code, your SSN could end up in log files, Git repositories, or local backups. Once PII is committed to a version control system like Git, it is extremely difficult to remove. Always use a sample SSN number from the 900-range.
Is there a "Check Digit" in an SSN?
Unlike credit card numbers (which use the Luhn algorithm) or IBANs, the U.S. Social Security Number does not have a check digit. There is no mathematical formula to verify if a sequence of 9 digits is a "legitimate" SSN other than checking it against the SSA's internal database or verifying it falls outside of the "invalid" ranges.
What is the most common sample SSN used in tutorials?
Historically, 123-45-6789 was used frequently. However, because this number could potentially be assigned (it doesn't fall into an invalid range), modern best practices recommend using 000-00-0000 or numbers in the 900 area code instead.
Does the SSA provide a tool to generate test SSNs?
The SSA does not provide a generator tool, but they do provide documentation on "Invalid Social Security Numbers" which serves as the blueprint for developers to create their own synthetic data generators.
How do I handle SSNs for non-citizens?
For individuals who are not eligible for an SSN but need to file taxes, the IRS issues an Individual Taxpayer Identification Number (ITIN). These also have 9 digits and start with the number 9. This further reinforces why using the 900 range is perfect for "sample" data—it mirrors the format of both SSNs and ITINs while remaining distinct from standard citizen issuance.
-
Topic: Identifying Invalid Social Security Numbershttps://www.orcainfo-com.com/uploads/identifying-invalid-ssn.pdf
-
Topic: PROPERTIES OF THE SOCIAL SECURITY NUMBER RELEVANT TO ITS USE IN RECORD LINKAGEShttps://www.irs.gov/pub/irs-soi/1985preprintar04.pdf
-
Topic: Social Security number - Wikipediahttps://en.m.wikipedia.org/wiki/Social_security_number