2020 census As of the
2020 census, Hartley had a population of 2,430, with a population density of . The census reported that 99.8% of the population lived in households, 6 people (0.2%) lived in non-institutionalized group quarters, and no one was institutionalized. 7.3% of residents lived in urban areas, while 92.7% lived in rural areas. The age distribution was 19.1% under the age of 18, 6.1% aged 18 to 24, 23.0% aged 25 to 44, 30.3% aged 45 to 64, and 21.4% who were 65 years of age or older. The median age was 47.0 years. For every 100 females, there were 97.1 males, and for every 100 females age 18 and over there were 97.3 males age 18 and over. There were 899 housing units at an average density of , of which 849 (94.4%) were occupied. Of these, 86.0% were owner-occupied, and 14.0% were occupied by renters. 5.6% of housing units were vacant; the homeowner vacancy rate was 0.1% and the rental vacancy rate was 4.0%. ==Education==