I am looking for a list of all US cities and their latitude and longitude.
Ideally something free will work but I'm willing to pay for it if its not too expensive and its complete.
Open Data Stack Exchange is a question and answer site for developers and researchers interested in open data. It only takes a minute to sign up.Sign up to join this community
A simple, accurate, and up-to-date database of United States cities and towns, built from the ground up using authoritative sources such as the U.S. Geological Survey and U.S. Census Bureau.
The Basic (free) database will meet many users' needs. You may want to purchase the Pro or Comprehensive versions if:
The SQL file contains two tables:
US_STATES: ID, STATE_CODE, and STATE_NAME.
US_CITIES: ID, ID_STATE, CITY, COUNTY, LATITUDE, and LONGITUDE.
The US_CITIES table has all (or almost all) cities from the United States.
The U.S. Census Bureau is the authoritative government agency that has been tasked with managing national data about governments (state, local, and municipal) and the boundaries that they claim.
The latest data includes administrative boundaries for cities, towns, and CDP's (Census Designated Places). What is a CDP? Think of them as an area that is not a city/town nor is incorporated but is recognized as a distinct area for which to produce economic/social estimates.
If you're feeling adventurous and want to look through the boundaries shapefile joined with an abundance of demographic/social/economic estimates through their American Community Survey you might be able to delve into their Demographic Profile series in this directory.
If you are doing this with R, I would (and regularly do) use TidyCensus. It is an interface to the census API, including the ability pull down census place data with its geometry. A quick call to st_centroid() would get you representative points. The place data on the SFTP website referenced in other answers typically has a representative lat-long with the place download.
Check out the US Geological Survey's Geographic Names Information System (USGS GNIS).
In particular, see FederalCodes which is described as:
Domestic names records that have assigned Census codes, Census class codes, General Services Administration (GSA) codes, or Office of Personnel Management (OPM) codes. Available geographic extents are National, States, and AllStates (bundled States).
The zip file contains a pipe-delimited TXT file that includes US cities and their coordinates.
Alternatively, you can try the US Census' County and County Equivalent Entities. Here's the link to the national TXT file. It gets the job done but the way the cities are formatted isn't ideal in my opinion. For example, towns/cities are appended with "township", "town", "city", and even "town city" in some cases. In comparison, the cities in the GNIS data are in a format that would be more familiar to most people.