- Help
- US county database
How to use the US county database
Pick a version, download it, and open it in Excel or load it into your database, with the commands to copy. Then get every release for 12 months at the same link.
Updated
Pick a version
Free holds the 3,144 counties and county equivalents of the 50 states and DC, each with its FIPS code, centre point, population and time zone. Pro adds Puerto Rico’s municipios and the Island Areas, 3,235 in all, and more columns: land area, metro area, every time zone and each county’s ZIP codes. Complete adds who lives there and the outline of every county.
- Free is for any project, commercial ones too, with a link to the database’s page where people can see it.
- Pro and Complete need no link: use them across your organisation, in your websites and apps too.
- Free’s columns come first in Pro and Complete, in the same order, so a formula or a query keeps working when you move up.
- Need ZIP codes and cities too? All three US databases, each in its Complete version, cost $199 together instead of $297.
Download your files
The free version downloads at once: a zip with the CSV, the Excel file and a README. For Pro or Complete, FastSpring’s checkout opens on the page. Once you have paid, the page turns into your download page, and a private link to it comes by email.
- No Geloky account needed. Keep the email: its link is your download page for 12 months.
- Each format downloads on its own, or take them all in one zip.
- Lost the link? Find my downloads sends it again to the email you paid with.
Open it in Excel or Google Sheets
Open the Excel file as it is: its FIPS codes are stored as text, so 01001 keeps its leading zero. To add a county’s population or time zone to your own list, put the database on a sheet named Counties and look each FIPS code up:
=XLOOKUP(TEXT(A2,"00000"), Counties!A:A, Counties!H:H, "not found")
- Column H is population. Use I for the time zone, or C for the full name.
TEXT(A2,"00000")turns a FIPS code your list stores as a number, like 6037, back into 06037.- Have names, not codes? In Excel 365,
=XLOOKUP(A2&B2, Counties!C:C&Counties!D:D, Counties!A:A)finds the FIPS code of Cook County (A2) in IL (B2). - Opening the CSV instead? Use Data › From Text/CSV and set county_fips to Text, or Excel drops the zeros.
- In Google Sheets, upload the Excel file: its FIPS codes stay text, and the first XLOOKUP works.
Load it into a database
The SQL zip holds one file for MySQL and MariaDB, and one for PostgreSQL. Each creates a table named us_counties, with the FIPS code as its key, and fills it:
mysql -u you -p yourdb < us-counties-pro-mysql.sql psql -d yourdb -f us-counties-pro-postgresql.sql
Then ask it what you need, such as the counties of the Chicago metro area, largest first:
SELECT county_full, state_id, population FROM us_counties WHERE metro_code = '16980' ORDER BY population DESC;
- A column with several values separates them with |: a county’s ZIP codes in zip_codes, its time zones in timezone_all.
- TRUE and FALSE load as booleans. A value the sources don’t have is NULL.
- Loading a new release? Drop the old table first:
DROP TABLE us_counties;
Use the JSON or the county outlines
The JSON file is one array with an object for each county, under the same names as the CSV columns. Complete adds the outline of each of the 3,235 counties, as GeoJSON and KML, for maps in QGIS, Google Earth, Leaflet or MapLibre.
- In the JSON, numbers are numbers, FIPS codes are strings, and a missing value is null.
- Each outline carries county_fips and county_full, to join it to the table.
- The outlines are detailed: about 23 MB as GeoJSON. For a web map, simplify them first, with mapshaper for example.
Get each update
For 12 months, every new release comes to the same link, and we email you when one is out. We aim to publish a release every quarter, with the ZIP codes of each county. The Census figures change once a year, and county lines rarely.
- Your download page lists every release you can get, newest first.
- Bought Pro? Upgrade to Complete on that page for the $50 difference. Your updates keep their end date.
- After the 12 months, everything you downloaded stays yours; only new releases stop.
Free holds the 50 states and DC. Pro and Complete add Puerto Rico’s 78 municipios and the 13 county equivalents of the Island Areas: American Samoa’s districts and islands, Guam, the Northern Mariana Islands’ municipalities and the three main US Virgin Islands. The Island Areas come without population: the Census Bureau’s survey doesn’t cover them.
Since 2022 the Census Bureau lists Connecticut’s nine planning regions instead of its eight old counties, with new FIPS codes, 09110 to 09190. The database follows it, so data with the old codes, 09001 to 09015, needs them matched to the regions by town.
timezone is the time zone of most of the county, from the Weather Service’s forecast zones. A time zone line crosses 13 counties: Pro and Complete list both of their zones in timezone_all. In Arizona, Apache, Coconino and Navajo counties keep America/Phoenix and list America/Denver too, for the Navajo Nation, which changes its clocks.
Link to geloky.com/data/us-counties from a page people can see where you use the data, such as the page with your map. If you use it only inside your organisation, put the link on your website, on a page people can reach from your home page.
Yes, for your project only. Your whole organisation may use the data, in its websites and apps too, but don’t publish, sell or give away the files themselves. The data licence has the details.
Yes. The API’s county lookup gives the free version’s columns for up to 100 counties a call, by FIPS code or by name and state, at $0.001 per county found. AI assistants connected to Geloky can use it too.
Your first 100 rows are free. Every day.
Free plan, no credit card · See your results on a map before you pay