Hägendorf is first mentioned in 1036 as *Hagendorf*. In 1102-03 it was mentioned as *Haegindorf*.

Hägendorf has an area, as of 2009, of 13.94 square kilometers (5.38 sq mi). Of this area, 3.7 km^{2} (1.4 sq mi) or 26.5% is used for agricultural purposes, while 8.06 km^{2} (3.11 sq mi) or 57.8% is forested. Of the rest of the land, 2.1 km^{2} (0.81 sq mi) or 15.1% is settled (buildings or roads) and 0.01 km^{2} (2.5 acres) or 0.1% is unproductive land.

Of the built up area, industrial buildings made up 1.3% of the total area while housing and buildings made up 7.6% and transportation infrastructure made up 5.0%. Out of the forested land, 56.1% of the total land area is heavily forested and 1.7% is covered with orchards or small clusters of trees. Of the agricultural land, 7.7% is used for growing crops and 15.4% is pastures and 2.5% is used for alpine pastures.

The municipality is located in the Olten district, along a stream at the southern foot of the Jura Mountains. It consists of the village of Hägendorf, scattered settlements on Vogelberg and Eggberg and individual alpine farms in the Jura Mountains, including the buildings and clinic at Allerheiligenberg farm.

The blazon of the municipal coat of arms is *Per bend serrated Argent and Sable.*

Hägendorf has a population (as of December 2015) of 4,866. As of 2008, 18.5% of the population are resident foreign nationals. Over the last 10 years (1999-2009 ) the population has changed at a rate of 9%.

Most of the population (as of 2000) speaks German (3,801 or 91.0%), with Italian being second most common (96 or 2.3%) and Albanian being third (90 or 2.2%). There are 25 people who speak French and 2 people who speak Romansh.

As of 2008, the gender distribution of the population was 49.1% male and 50.9% female. The population was made up of 1,781 Swiss men (39.1% of the population) and 457 (10.0%) non-Swiss men. There were 1,923 Swiss women (42.2%) and 399 (8.8%) non-Swiss women. Of the population in the municipality 1,141 or about 27.3% were born in Hägendorf and lived there in 2000. There were 1,152 or 27.6% who were born in the same canton, while 1,100 or 26.3% were born somewhere else in Switzerland, and 621 or 14.9% were born outside of Switzerland.

In 2008 there were 33 live births to Swiss citizens and 9 births to non-Swiss citizens, and in same time span there were 20 deaths of Swiss citizens and 2 non-Swiss citizen deaths. Ignoring immigration and emigration, the population of Swiss citizens increased by 13 while the foreign population increased by 7. There were 7 Swiss men and 4 Swiss women who immigrated back to Switzerland. At the same time, there were 9 non-Swiss men and 7 non-Swiss women who immigrated from another country to Switzerland. The total Swiss population change in 2008 (from all sources, including moves across municipal borders) was an increase of 41 and the non-Swiss population increased by 44 people. This represents a population growth rate of 1.9%.

The age distribution, as of 2000, in Hägendorf is; 308 children or 7.4% of the population are between 0 and 6 years old and 676 teenagers or 16.2% are between 7 and 19. Of the adult population, 223 people or 5.3% of the population are between 20 and 24 years old. 1,239 people or 29.7% are between 25 and 44, and 1,104 people or 26.4% are between 45 and 64. The senior population distribution is 488 people or 11.7% of the population are between 65 and 79 years old and there are 140 people or 3.4% who are over 80.

As of 2000, there were 1,584 people who were single and never married in the municipality. There were 2,124 married individuals, 255 widows or widowers and 215 individuals who are divorced.

As of 2000, there were 1,730 private households in the municipality, and an average of 2.4 persons per household. There were 498 households that consist of only one person and 105 households with five or more people. Out of a total of 1,750 households that answered this question, 28.5% were households made up of just one person and there were 11 adults who lived with their parents. Of the rest of the households, there are 557 married couples without children, 563 married couples with children There were 79 single parents with a child or children. There were 22 households that were made up of unrelated people and 20 households that were made up of some sort of institution or another collective housing.

In 2000 there were 849 single family homes (or 74.8% of the total) out of a total of 1,135 inhabited buildings. There were 151 multi-family buildings (13.3%), along with 90 multi-purpose buildings that were mostly used for housing (7.9%) and 45 other use buildings (commercial or industrial) that also had some housing (4.0%). Of the single family homes 66 were built before 1919, while 117 were built between 1990 and 2000. The greatest number of single family homes (172) were built between 1981 and 1990.

In 2000 there were 1,873 apartments in the municipality. The most common apartment size was 4 rooms of which there were 556. There were 23 single room apartments and 793 apartments with five or more rooms. Of these apartments, a total of 1,701 apartments (90.8% of the total) were permanently occupied, while 99 apartments (5.3%) were seasonally occupied and 73 apartments (3.9%) were empty. As of 2009, the construction rate of new housing units was 2.6 new units per 1000 residents. The vacancy rate for the municipality, in 2010, was 0.45%.

The historical population is given in the following chart:

In the 2007 federal election the most popular party was the SVP which received 34.62% of the vote. The next three most popular parties were the CVP (21.16%), the FDP (18.91%) and the SP (17.32%). In the federal election, a total of 1,548 votes were cast, and the voter turnout was 52.1%.

As of 2010, Hägendorf had an unemployment rate of 3.2%. As of 2008, there were 39 people employed in the primary economic sector and about 15 businesses involved in this sector. 752 people were employed in the secondary sector and there were 47 businesses in this sector. 1,926 people were employed in the tertiary sector, with 158 businesses in this sector. There were 2,229 residents of the municipality who were employed in some capacity, of which females made up 45.6% of the workforce.

In 2008 the total number of full-time equivalent jobs was 2,308. The number of jobs in the primary sector was 26, of which 25 were in agriculture and 1 was in forestry or lumber production. The number of jobs in the secondary sector was 725 of which 526 or (72.6%) were in manufacturing and 193 (26.6%) were in construction. The number of jobs in the tertiary sector was 1,557. In the tertiary sector; 703 or 45.2% were in wholesale or retail sales or the repair of motor vehicles, 257 or 16.5% were in the movement and storage of goods, 36 or 2.3% were in a hotel or restaurant, 46 or 3.0% were in the information industry, 16 or 1.0% were the insurance or financial industry, 71 or 4.6% were technical professionals or scientists, 52 or 3.3% were in education and 308 or 19.8% were in health care.

In 2000, there were 1,593 workers who commuted into the municipality and 1,553 workers who commuted away. The municipality is a net importer of workers, with about 1.0 workers entering the municipality for every one leaving. Of the working population, 14.4% used public transportation to get to work, and 62.5% used a private car.

From the 2000 census, 2,194 or 52.5% were Roman Catholic, while 1,122 or 26.9% belonged to the Swiss Reformed Church. Of the rest of the population, there were 49 members of an Orthodox church (or about 1.17% of the population), there were 47 individuals (or about 1.12% of the population) who belonged to the Christian Catholic Church, and there were 49 individuals (or about 1.17% of the population) who belonged to another Christian church. There were 180 (or about 4.31% of the population) who were Islamic. There were 12 individuals who were Buddhist, 9 individuals who were Hindu and 2 individuals who belonged to another church. 388 (or about 9.29% of the population) belonged to no church, are agnostic or atheist, and 126 individuals (or about 3.02% of the population) did not answer the question.

In Hägendorf about 1,741 or (41.7%) of the population have completed non-mandatory upper secondary education, and 475 or (11.4%) have completed additional higher education (either university or a *Fachhochschule*). Of the 475 who completed tertiary schooling, 76.0% were Swiss men, 16.6% were Swiss women, 4.2% were non-Swiss men and 3.2% were non-Swiss women.

During the 2010-2011 school year there were a total of 397 students in the Hägendorf school system. The education system in the Canton of Solothurn allows young children to attend two years of non-obligatory Kindergarten. During that school year, there were 95 children in kindergarten. The canton's school system requires students to attend six years of primary school, with some of the children attending smaller, specialized classes. In the municipality there were 280 students in primary school and 22 students in the special, smaller classes. The secondary school program consists of three lower, obligatory years of schooling, followed by three to five years of optional, advanced schools. All the lower secondary students from Hägendorf attend their school in a neighboring municipality.

As of 2000, there were 116 students in Hägendorf who came from another municipality, while 130 residents attended schools outside the municipality.

Hägendorf is home to the *Gemeindebibliothek Hägendorf* (municipal library of Hägendorf). The library has (as of 2008) 4,628 books or other media, and loaned out 4,229 items in the same year. It was open a total of 126 days with average of 6 hours per week during that year.