How to Look Up US County FIPS Codes Programmatically
FIPS codes are 5-digit identifiers assigned to every county and county-equivalent in the United States by the Census Bureau. The code consists of a 2-digit state code followed by a 3-digit county code. There are over 3,200 FIPS county codes covering all 50 states, the District of Columbia, and US territories.
If you work in mortgage technology, title insurance, property appraisal, GIS, or government data, you encounter FIPS codes constantly. Despite being a fundamental geographic identifier, there is no clean, fast public API for looking them up. Most teams end up embedding CSV files or scraping Census Bureau pages.
The structure of a FIPS code
FIPS codes follow a simple hierarchy:
- 2-digit state FIPS: Identifies the state (e.g., 06 = California, 48 = Texas, 36 = New York)
- 3-digit county FIPS: Identifies the county within that state (e.g., 037 = Los Angeles County)
- 5-digit combined FIPS: The full identifier (e.g., 06037 = Los Angeles County, California)
The state codes are not alphabetical by state name. They were assigned roughly in order of statehood and geographic region. Alabama is 01, Alaska is 02, but Arizona is 04 (03 was retired). You cannot derive the state from the code without a lookup table.
Some examples:
| FIPS Code | State | County |
|---|---|---|
| 06037 | California | Los Angeles County |
| 48201 | Texas | Harris County (Houston) |
| 36061 | New York | New York County (Manhattan) |
| 17031 | Illinois | Cook County (Chicago) |
| 04013 | Arizona | Maricopa County (Phoenix) |
Who needs FIPS codes
FIPS codes are required by a surprisingly large number of industries:
Mortgage and lending. FHA loan limits, conforming loan limits, and HMDA (Home Mortgage Disclosure Act) reporting all use FIPS codes. When a loan officer enters a property address, the system must resolve it to a FIPS code to determine the applicable loan limits. Getting the wrong county means quoting the wrong limit.
Title insurance. Title companies use FIPS codes to route orders to the correct county recorder's office and to look up county-specific recording fees and transfer taxes.
Property appraisal. Comparable sales databases are organized by FIPS code. Appraisal management companies use FIPS codes to assign orders to local appraisers.
GIS and mapping. Census Bureau shapefiles, USDA crop data, EPA environmental data, and FEMA flood zones are all keyed by FIPS code. Any application that joins geographic datasets needs FIPS as the common key.
Insurance. Property and casualty insurers use FIPS codes to map risk zones for windstorm, earthquake, flood, and wildfire exposure.
Government reporting. Federal grant applications, disaster declarations, and public health data (including CDC reporting) all reference counties by FIPS code.
Looking up FIPS codes
The MCP server @easysolutions906/mcp-fips provides the full Census Bureau county dataset with search, lookup, and listing tools.
Lookup by FIPS code
Looking up code 06037:
{
"fipsCode": "06037",
"stateFips": "06",
"countyFips": "037",
"countyName": "Los Angeles County",
"stateAbbr": "CA",
"stateName": "California",
"classCode": "H1",
"classDescription": "An active county or equivalent"
}
The class code indicates the type of geographic entity. H1 is a standard county, H4 is a city that functions as a county (like Baltimore City, MD), H5 is a consolidated city-county (like San Francisco), and H6 is a borough (like the boroughs of Alaska and New York City).
Search by county name
Searching for "los angeles":
{
"query": "los angeles",
"results": [
{
"fipsCode": "06037",
"countyName": "Los Angeles County",
"stateAbbr": "CA",
"stateName": "California"
}
],
"totalResults": 1
}
Searching for "washington" is more interesting -- it returns Washington County in over 30 states:
{
"query": "washington",
"results": [
{ "fipsCode": "05143", "countyName": "Washington County", "stateAbbr": "AR" },
{ "fipsCode": "08121", "countyName": "Washington County", "stateAbbr": "CO" },
{ "fipsCode": "12133", "countyName": "Washington County", "stateAbbr": "FL" },
{ "fipsCode": "41067", "countyName": "Washington County", "stateAbbr": "OR" }
],
"totalResults": 31
}
This is why state context matters when searching by county name. The search supports filtering by state to narrow results.
List counties in a state
Listing all counties in Texas (state FIPS 48):
{
"stateFips": "48",
"stateName": "Texas",
"stateAbbr": "TX",
"counties": [
{ "fipsCode": "48001", "countyName": "Anderson County" },
{ "fipsCode": "48003", "countyName": "Andrews County" },
{ "fipsCode": "48005", "countyName": "Angelina County" },
{ "fipsCode": "48201", "countyName": "Harris County" }
],
"totalCounties": 254
}
Texas has 254 counties -- the most of any US state. Georgia is second with 159.
Setting up the MCP server
Add to your Claude Desktop or Cursor configuration:
{
"mcpServers": {
"fips": {
"command": "npx",
"args": ["-y", "@easysolutions906/mcp-fips"]
}
}
}
The server exposes fips_lookup, fips_search, and fips_list_state tools. After restarting, ask:
- "What county is FIPS code 06037?"
- "Find the FIPS code for Harris County, Texas"
- "List all counties in California"
- "What is the FIPS code for Manhattan?"
Integration example
A common pattern in mortgage applications: the user enters a property address, and you need to resolve the county and FIPS code for loan limit determination.
const lookupFipsForAddress = async (county, state) => {
const res = await fetch(
`https://your-api-url.com/search?q=${encodeURIComponent(county)}&state=${state}&limit=1`
);
const data = await res.json();
if (data.results.length === 0) {
return null;
}
const { fipsCode, countyName } = data.results[0];
return { fipsCode, countyName };
};
// Resolve Los Angeles, CA to its FIPS code
const result = await lookupFipsForAddress('Los Angeles', 'CA');
// { fipsCode: '06037', countyName: 'Los Angeles County' }
Once you have the FIPS code, you can use it to look up FHA loan limits, flood zone designations, property tax rates, and any other county-level data.
FIPS codes are the quiet glue that holds geographic data together in the United States. The @easysolutions906/mcp-fips MCP server and npm package provide the full Census Bureau dataset as searchable tools, so you do not need to maintain your own county lookup tables.
Top comments (0)