As of the census of 2010, there were 39,662 people, 16,449 households, and 9,436 families residing in the city. The population density was 3,364.0 inhabitants per square mile (1,298.8/km). There were 18,682 housing units at an average density of 1,584.6 per square mile (611.8/km). The racial makeup of the city was 75.8% White, 15.5% African American, 0.3% Native American, 1.3% Asian, 0.1% Pacific Islander, 2.1% from other races, and 5.1% from two or more races. Hispanic or Latino of any race were 5.6% of the population.
There were 16,449 households of which 32.9% had children under the age of 18 living with them, 33.6% were married couples living together, 18.4% had a female householder with no husband present, 5.4% had a male householder with no wife present, and 42.6% were non-families. 34.5% of all households were made up of individuals and 10.5% had someone living alone who was 65 years of age or older. The average household size was 2.36 and the average family size was 3.04.
The median age in the city was 34.5 years. 25.8% of residents were under the age of 18; 9.5% were between the ages of 18 and 24; 28.6% were from 25 to 44; 24% were from 45 to 64; and 12.3% were 65 years of age or older. The gender makeup of the city was 47.3% male and 52.7% female. Between 2011 and 2015, 26.8% of the population lived in poverty.
As of the U.S. census of 2000, there were 36,687 people, 15,849 households, and 9,081 families residing in the city. Updated 1 July 2008 census estimates reflect Hagerstown having 39,728 people, an increase of 8.3% from the year 2000.
According to Census 2000 figures, the population density was 3,441.5 people per square mile (1,328.8/km²). There were 17,089 housing units at an average density of 1,603.1 per square mile (619.0/km²). The racial makeup of the city was 85.95% White, 10.15% Black, 1.77% Hispanic or Latino, 0.25% Native American, 0.96% Asian, 0.04% Pacific Islander, 0.83% from other races, and 1.83% from two or more races. There were 17,154 males and 19,533 females residing in the city.
There were 15,849 households out of which 29.5% had children under the age of 18 living with them, 36.8% were married couples living together, 15.9% had a female householder with no husband present, and 42.7% were non-families. 35.4% of all households were made up of individuals and 12.9% had someone living alone who was 65 years of age or older. The average household size was 2.26 and the average family size was 2.93.
In the city, the population was spread out with 25.6% under the age of 18, 9.0% from 18 to 24, 31.0% from 25 to 44, 20.1% from 45 to 64, and 14.3% who were 65 years of age or older. The median age was 35 years. For every 100 females, there were 87.8 males. For every 100 females age 18 and over, there were 83.6 males.
The median income for a household in the city was $30,796, and the median income for a family was $38,149. Males had a median income of $31,200 versus $22,549 for females. The per capita income for the city was $17,153. About 15.1% of families and 18.1% of the population were below the poverty line, including 27.0% of those under age 18 and 13.7% of those age 65 or over.