Hartford is a city in Geneva County, Alabama, United States. It incorporated in 1896. It is part of the Dothan, Alabama Metropolitan Statistical Area. At the 2020 census, the population was 2,651, an increase over the figure of 2,624 tabulated in 2010.
 Hartford is located at 31°6′13″N 85°41′40″W﻿ / ﻿31.10361°N 85.69444°W﻿ / 31.10361; -85.69444 (31.103664, -85.694544).
 According to the U.S. Census Bureau, the city has a total area of 6.2 square miles (16 km2), of which 6.2 square miles (16 km2) is land and 0.16% is water.
 At the 2000 census there were 2,369 people, 966 households, and 647 families living in the city. The population density was 380.1 inhabitants per square mile (146.8/km2). There were 1,121 housing units at an average density of 179.9 per square mile (69.5/km2).  The racial makeup of the city was 79.11% White, 19.63% Black or African American, 0.42% Native American, 0.30% from other races, and 0.55% from two or more races. 1.69% of the population were Hispanic or Latino of any race.
Of the 966 households 27.3% had children under the age of 18 living with them, 49.0% were married couples living together, 13.8% had a female householder with no husband present, and 33.0% were non-families. 31.1% of households were one person and 15.0% were one person aged 65 or older. The average household size was 2.35 and the average family size was 2.90.
 The age distribution was 22.9% under the age of 18, 6.4% from 18 to 24, 24.1% from 25 to 44, 24.5% from 45 to 64, and 22.1% 65 or older. The median age was 43 years. For every 100 females, there were 84.5 males. For every 100 females age 18 and over, there were 77.5 males.
 The median household income was $23,324 and the median family income  was $30,919. Males had a median income of $25,843 versus $21,838 for females. The per capita income for the city was $13,290. About 19.9% of families and 19.8% of the population were below the poverty line, including 29.0% of those under age 18 and 19.1% of those age 65 or over.
 At the 2010 census there were 2,624 people, 1,059 households, and 677 families living in the city. The population density was 423.2 inhabitants per square mile (163.4/km2). There were 1,196 housing units at an average density of 192.9 per square mile (74.5/km2). The racial makeup of the city was 77.9% White, 17.9% Black or African American, 0.6% Native American, 1.8% from other races, and 1.8% from two or more races. 3.1% of the population were Hispanic or Latino of any race.
Of the 1,059 households 23.0% had children under the age of 18 living with them, 44.3% were married couples living together, 15.6% had a female householder with no husband present, and 36.1% were non-families. 32.5% of households were one person and 16.2% were one person aged 65 or older. The average household size was 2.40 and the average family size was 3.02.
 The age distribution was 21.8% under the age of 18, 9.5% from 18 to 24, 20.9% from 25 to 44, 26.1% from 45 to 64, and 21.6% 65 or older. The median age was 42.9 years. For every 100 females, there were 87.0 males. For every 100 females age 18 and over, there were 94.0 males.
 The median household income was $26,086 and the median family income  was $36,900. Males had a median income of $31,505 versus $17,369 for females. The per capita income for the city was $16,507. About 14.9% of families and 21.1% of the population were below the poverty line, including 16.0% of those under age 18 and 20.6% of those age 65 or over.
 As of the 2020 United States census, there were 2,651 people, 934 households, and 565 families residing in the city.