US EIN (Employer Identification Number) Regular Expression

A regular expression that matches a valid EIN (Employer Identification Number) number.

The Employer Identification Number (EIN) is a unique serial number assigned by the IRS to business entities operating in the US. The EIN contains nine digits divided into three groups: “two-digits, dash, seven-digits”. It is separate from the Social Security Number, which is used by individuals.

^\d{2}\-?\d{7}$

Matches:

  • 15-4321671
  • 154321671

Non-matches:

  • 154-321671
  • 12-4321672
  • ab-1234567

See Also:

Regex Is Copied!