53033 FipsDecoder

Virginia Independent Cities: FIPS Codes and Federal Data

Virginia is unique among US states: it has 38 independent cities that are not part of any county. Each independent city has its own 5-digit FIPS code and appears in federal datasets exactly like a county — even though it is legally a city, not a county.

This is the #1 source of missing data and double-counting errors when analysts work with Virginia data from the Census Bureau, BLS, EPA, HUD, or any other federal agency.

What "Independent" Means

In most states, cities are inside counties. You can find a city within its county, and county-level data includes the city. In Virginia, independent cities are outside all counties — they are county-level entities in their own right. A Virginia independent city is not contained in any county, and county data for the surrounding area excludes the city.

Example: Richmond is an independent city (FIPS 51760). It is not part of Henrico County or Chesterfield County, even though those counties surround it on all sides. If you query BLS wage data for Henrico County, you will not get Richmond city data. You need to query both codes separately.

Independent Cities vs County-Adjacent Cities

Common mistake: assuming cities are inside counties

If you're aggregating Virginia to the state level by summing county FIPS codes, you'll undercount unless you also include all 38 independent city FIPS codes. They won't show up in a WHERE state_fips = '51' query that expects county-level rows — they will, but only if your table correctly includes them as county-equivalent rows.

FIPS Class Code H4 and C7

Independent cities in Virginia carry one of two FIPS class codes:

  • C7 — An independent city in Virginia with a population of 100,000 or more
  • H4 — An independent city in Virginia with a population under 100,000, or an independent city in another state (Nevada has one: Carson City)

On FipsDecoder, every county or county-equivalent page with class code H4 or C7 shows a warning banner explaining its independent city status.

Virginia's 38 Independent Cities — FIPS Codes

How to Handle This in Code

import pandas as pd

# Getting all Virginia county-equivalents (counties + independent cities)
va_fips = df[df['state_fips'] == '51']  # includes all county-equiv rows

# Checking if a Virginia FIPS is an independent city
# Independent cities: 510xx–51840 range in the county portion
def is_va_independent_city(fips: str) -> bool:
    if len(fips) != 5 or fips[:2] != '51':
        return False
    county_part = int(fips[2:])
    # Independent cities use codes 500+ in the county portion
    return county_part >= 500

# In SQL: Virginia's independent cities all have county_fips >= 500
SELECT * FROM counties
WHERE state_fips = '51'
  AND CAST(county_fips AS integer) >= 500;