The complete hierarchical relationship between US states, counties, and cities with standardized FIPS codes at every level. This dataset enables geographic drill-down interfaces, government compliance reporting, and administrative boundary lookups in a single flat file.
Pro tip: Use the FIPS codes as stable foreign keys in your database — unlike names, FIPS codes never change due to spelling variations or city renaming.
Select which columns to include in your download.
About the State-County-City Dataset
This dataset provides the complete hierarchical structure of US administrative geography: every state, its counties (or county equivalents), and the cities within each county. Each level includes the standardized Federal Information Processing Standards (FIPS) code assigned by the US Census Bureau. The flat-file format makes it easy to import into any database or spreadsheet while preserving the parent-child relationships through the FIPS code hierarchy.
Common Use Cases
Hierarchical geographic data is critical for applications that need to represent or navigate US administrative boundaries:
- Cascading location selectors: Build three-level dropdown menus where selecting a state populates the county list, and selecting a county populates the city list — all from a single data source.
- Government and compliance reporting: Many federal and state programs require data submission organized by FIPS codes. This dataset provides the lookup table needed to tag records with the correct codes.
- Geographic aggregation: Roll up city-level metrics to the county or state level for dashboards, reports, and data warehousing pipelines that need consistent administrative boundaries.
- Election and political data: Match election results, voter registration data, and political boundary information using FIPS codes as the universal join key across disparate government datasets.
Understanding FIPS Codes
FIPS codes are numeric identifiers assigned by the National Institute of Standards and Technology to uniquely identify geographic entities. State FIPS codes are two digits (e.g. 06 for California), county FIPS codes are five digits combining the state and county codes (e.g. 06037 for Los Angeles County), and place FIPS codes extend further to identify individual cities and towns. These codes provide a stable, unambiguous identifier that avoids the problems of name-based matching such as spelling variations, duplicate city names across states, and special characters.
Column Reference
The dataset includes the following columns to represent the three-level hierarchy:
- state_name — The full name of the state or territory.
- state_abbr — The two-letter USPS state abbreviation.
- state_fips — The two-digit FIPS code for the state.
- county_name — The county, parish, borough, or equivalent jurisdiction name.
- county_fips — The five-digit combined state-county FIPS code.
- city_name — The city, town, or census-designated place name.
- city_fips — The full FIPS place code for the city.
Data Structure and Import Tips
The dataset is denormalized into a flat table where each row represents one city with its parent county and state information repeated. This design makes CSV and SQL imports straightforward without requiring multiple related tables. If you prefer a normalized structure, use the SQL export and split into three tables joined by FIPS codes. When importing, always define FIPS code columns as zero-padded strings rather than integers to preserve leading zeros — state code 06 for California would lose its leading zero if stored as an integer.