# EIN Format Validation: The XX-XXXXXXX Rules

- Canonical: https://schematax.com/blog/ein-format-validation
- Author: Schema Tax (https://schematax.com)
- Published: 2025-11-03T13:20:38.000Z
- Updated: 2025-11-03T13:20:38.000Z

EIN format validation checks that an employer identification number has nine digits written as XX-XXXXXXX, with one hyphen after the second digit, and that its first two digits are a prefix the IRS lists as valid. A number that passes has the right shape. It may still not belong to any business.

## The XX-XXXXXXX layout of an EIN

An employer identification number (EIN) is the nine-digit federal tax ID the IRS gives to businesses, estates, trusts and other entities. On paper it is written as two digits, a hyphen and seven digits. The [IRS General Instructions for Certain Information Returns](https://www.irs.gov/instructions/i1099gi) say EINs have "nine digits separated by only one hyphen (00-0000000)."

That single hyphen is the visible difference between an EIN and the other TINs. The same instructions say SSNs, ITINs and ATINs have nine digits separated by two hyphens. A number shown as 3-2-4 is not in EIN layout, even if its digits would pass every other test.

For storage, most systems keep the EIN as nine digits with no hyphen and add the hyphen back when they print it. Store it as text, not as a number. A spreadsheet column formatted as a number drops leading zeros, and an EIN that begins with 0 then shrinks to eight digits.

The [IRS General Instructions for Forms W-2 and W-3](https://www.irs.gov/instructions/iw2w3) add a rule that matters when you read forms: an employer's EIN "may not be truncated on any form." A payer or employer EIN on a W-2 or 1099 should therefore always show all nine digits.

## Which EIN prefixes does the IRS issue?

The EIN prefix is the first two digits of the number. The IRS page on [how EINs are assigned and valid EIN prefixes](https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes) says these digits show the IRS campus that assigned the EIN, or whether it was applied for online, and lists every valid prefix by campus.

The table below copies the IRS list as it stood when this post was written. Some prefixes appear under more than one location.

| Campus or location | Valid EIN prefixes |
| --- | --- |
| Andover | 10, 12 |
| Atlanta | 60, 67 |
| Austin | 50, 53 |
| Brookhaven | 01, 02, 03, 04, 05, 06, 11, 13, 14, 16, 21, 22, 23, 25, 34, 51, 52, 54, 55, 56, 57, 58, 59, 65 |
| Cincinnati | 30, 32, 35, 36, 37, 38, 61 |
| Fresno | 15, 24 |
| Kansas City | 40, 44 |
| Memphis | 94, 95 |
| Ogden | 80, 90 |
| Philadelphia | 33, 39, 41, 42, 43, 46, 48, 62, 63, 64, 66, 68, 71, 72, 73, 74, 75, 76, 77, 85, 86, 87, 88, 91, 92, 93, 98, 99 |
| Internet | 20, 26, 27, 33, 39, 41, 42, 45, 46, 47, 81, 82, 83, 84, 85, 86, 87, 88, 92, 93, 99 |
| Small Business Administration | 31 |

Seventeen two-digit values do not appear anywhere on that list: 00, 07, 08, 09, 17, 18, 19, 28, 29, 49, 69, 70, 78, 79, 89, 96 and 97. An EIN starting with one of them fails format validation against the current IRS list. Because the IRS can update the page, keep the prefix list in one place in your code or workbook so it is easy to refresh.

## An EIN format validation regex and spreadsheet check

An EIN format validation regex tests the digit count, the optional hyphen and the prefix in one expression. The version below accepts the number with or without the hyphen after the second digit, and allows only the prefixes on the IRS prefix list.

```
^(0[1-6]|1[0-6]|2[0-7]|3[0-9]|4[0-8]|5[0-9]|6[0-8]|7[1-7]|8[0-8]|9[0-58-9])-?[0-9]{7}$
```

Read the alternation as ranges: 01 to 06, 10 to 16, 20 to 27, all of the 30s, 40 to 48, all of the 50s, 60 to 68, 71 to 77, 80 to 88, 90 to 95, 98 and 99. Run it on a trimmed string. If your data must keep the printed layout, drop the `?` so the hyphen becomes required.

In Excel or Google Sheets, put the valid prefixes as text in a named range called `ValidPrefixes`, then test a value in A2:

```
=AND(LEN(A2)=10, MID(A2,3,1)="-",
  SUMPRODUCT(--ISNUMBER(--MID(SUBSTITUTE(A2,"-",""),ROW($1:$9),1)))=9,
  ISNUMBER(MATCH(LEFT(A2,2),ValidPrefixes,0)))
```

The formula checks the length, the hyphen position, that all nine remaining characters are digits, and that the prefix is on the list. Here is how both checks treat five example values. The passing rows use N for any digit so that no real EIN is printed.

| Example value (fictional) | Regex | Formula | Rule it tests |
| --- | --- | --- | --- |
| 20-NNNNNNN | Pass | Pass | Internet prefix, correct layout |
| 31NNNNNNN | Pass | Fail | No hyphen: the regex allows it, the formula requires it |
| 07-1234567 | Fail | Fail | Prefix 07 is not on the IRS list |
| 20-12345 | Fail | Fail | Only seven digits |
| 666-12-3456 | Fail | Fail | SSN layout with two hyphens |

## Does a valid EIN format mean the business is real?

A valid EIN format does not mean the business is real or that the number belongs to the name next to it. EIN format validation only proves the number could exist. The IRS issues the number, and only the IRS can say whether it issued that number to that entity.

A made-up number with a listed prefix and seven random digits passes every check in this post. So does a real EIN typed next to the wrong company name. Format rules catch typing slips, dropped digits and numbers from the wrong field. They do not catch a plausible fake.

The [IRS Employer ID Numbers page](https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers) notes that a new EIN may take up to two weeks before it will pass the IRS Taxpayer ID Number (TIN) Matching Program. That program is how payers check a name and TIN pair against IRS records, and the post on [who can use IRS TIN Matching](/blog/irs-tin-validation#who-can-use-irs-tin-matching) explains the access rules.

## EIN format mistakes in extracted data

EIN format mistakes in extracted data usually come from the tools between the form and the database, not from the form. Three patterns cover most failures: a leading zero that disappears, an SSN sitting in the EIN field, and two prefix digits read in the wrong order.

**Lost leading zeros.** Brookhaven prefixes 01 to 06 start with zero. Open a CSV in a spreadsheet and an EIN like 04-NNNNNNN can become an eight-digit number. Import EIN columns as text, and pad to nine digits only if you know the value lost a zero rather than a digit.

**An SSN in the EIN box.** A payer TIN in 3-2-4 layout on a 1099 is often a sole proprietor's SSN, which the IRS allows, not a broken EIN. The post on [which ID belongs in which box on a W-2 or 1099](/blog/ein-vs-ssn-vs-itin-format#which-id-belongs-in-which-box-on-a-w-2-or-1099) explains when that happens, and the [SSN format validation rules](/blog/ssn-format-validation) cover the checks that apply instead.

**Transposed prefixes.** Swapping the first two digits can turn a valid prefix into an unlisted one, such as 70 for 07, or into a different valid one. The prefix test catches the first case only. A number that starts with 9 is another trap: EIN prefixes 90 to 95, 98 and 99 are valid, so a leading 9 alone does not make a number an [ITIN](/blog/valid-itin).

Schema Tax tests each payer and employer TIN it reads against the XX-XXXXXXX pattern and flags a mismatch for review instead of passing it through, as its [five-step process](/#how) describes. For more on the forms where these numbers appear, browse the [1099 forms guides](/blog/category/1099-forms).
