US State Code generator

Last modified: April 3, 2025

The US State Code generator creates the official two-letter abbreviations for U.S. states and territories, as defined by the ISO 3166-2 standard (e.g., CA for California, TX for Texas, NY for New York). These codes are widely used for addressing, identification, and regional categorization in different systems.

Generator properties

The table provides key details about the generator, including the short name, sample of the generated data, the supported data types, and whether it is specific to a particular country.

Short name Example of generated data Data type matching Country-specific
US State Code NY, IN, OH, … charactercharacter varyingtext Default

Matching rules

The generator can be assigned to a column that matches any of the following rules:

  • The column name is ‘State’, regardless of the table name.
  • The column name starts with ‘billing’ or ‘shipping’ and then goes ‘code’, preceded or followed by any or no characters, regardless of the table name.
  • The column name is ‘abbr’, and it belongs to a table whose name contains ‘State’ or ‘Province’, preceded or followed by any or no characters.

Configure additional options

The generator produces data based on a regular expression. Since it is built on the RegExp generator, see Regular Expression generator to customize settings and understand the correct usage of syntax.

The Text box displays a .csv file that contain a list of state codes. The default path to the file is C:\Users\Public\Documents\Devart\dbForge Studio for PostgreSQL\Data Generators\USStateCodes.csv[0].

Preview of the column data generated by the US State Code generator

US State Code generator