Gretzenbach is first mentioned in 778 as Grezzinbach though this comes from a 10th Century copy of the older original. In 1265 it was mentioned as Grezenbach.
Gretzenbach has an area, as of 2009, of 5.8 square kilometers (2.2 sq mi). Of this area, 2.43 km2 (0.94 sq mi) or 41.9% is used for agricultural purposes, while 2.11 km2 (0.81 sq mi) or 36.4% is forested. Of the rest of the land, 1.22 km2 (0.47 sq mi) or 21.0% is settled (buildings or roads), 0.05 km2 (12 acres) or 0.9% is either rivers or lakes.
Of the built up area, industrial buildings made up 3.1% of the total area while housing and buildings made up 10.9% and transportation infrastructure made up 4.8%. Power and water infrastructure as well as other special developed areas made up 1.2% of the area Out of the forested land, 34.1% of the total land area is heavily forested and 2.2% is covered with orchards or small clusters of trees. Of the agricultural land, 24.1% is used for growing crops and 15.9% is pastures, while 1.9% is used for orchards or vine crops. All the water in the municipality is flowing water.
The municipality is located in the Olten district, on a terrace through which the Aare river has eroded a number of channels. It consists of the village of Gretzenbach, the settlement of Weid and, since 1973, the former municipality of Grod.
The blazon of the municipal coat of arms is Argent a Fir Tree Vert trunked proper issuant from a Mount of 3 Coupeaux of the second.
Gretzenbach has a population (as of December 2015) of 2,643. As of 2008, 15.3% of the population are resident foreign nationals. Over the last 10 years (1999–2009 ) the population has changed at a rate of 1%.
Most of the population (as of 2000) speaks German (2,203 or 92.1%), with Italian being second most common (72 or 3.0%) and Albanian being third (25 or 1.0%). There are 10 people who speak French and 1 person who speaks Romansh.
As of 2008, the gender distribution of the population was 50.9% male and 49.1% female. The population was made up of 1,036 Swiss men (42.3% of the population) and 210 (8.6%) non-Swiss men. There were 1,031 Swiss women (42.1%) and 171 (7.0%) non-Swiss women. Of the population in the municipality 718 or about 30.0% were born in Gretzenbach and lived there in 2000. There were 519 or 21.7% who were born in the same canton, while 784 or 32.8% were born somewhere else in Switzerland, and 318 or 13.3% were born outside of Switzerland.
In 2008 there were 9 live births to Swiss citizens and 5 births to non-Swiss citizens, and in same time span there were 18 deaths of Swiss citizens and 3 non-Swiss citizen deaths. Ignoring immigration and emigration, the population of Swiss citizens decreased by 9 while the foreign population increased by 2. There was 1 Swiss man and 2 Swiss women who emigrated from Switzerland. At the same time, there were 11 non-Swiss men and 1 non-Swiss woman who immigrated from another country to Switzerland. The total Swiss population change in 2008 (from all sources, including moves across municipal borders) was a decrease of 9 and the non-Swiss population increased by 13 people. This represents a population growth rate of 0.2%.
The age distribution, as of 2000, in Gretzenbach is; 228 children or 9.5% of the population are between 0 and 6 years old and 465 teenagers or 19.4% are between 7 and 19. Of the adult population, 115 people or 4.8% of the population are between 20 and 24 years old. 785 people or 32.8% are between 25 and 44, and 541 people or 22.6% are between 45 and 64. The senior population distribution is 198 people or 8.3% of the population are between 65 and 79 years old and there are 61 people or 2.5% who are over 80.
As of 2000, there were 1,025 people who were single and never married in the municipality. There were 1,176 married individuals, 111 widows or widowers and 81 individuals who are divorced.
As of 2000, there were 887 private households in the municipality, and an average of 2.7 persons per household. There were 210 households that consist of only one person and 97 households with five or more people. Out of a total of 891 households that answered this question, 23.6% were households made up of just one person and there were 9 adults who lived with their parents. Of the rest of the households, there are 232 married couples without children, 380 married couples with children There were 47 single parents with a child or children. There were 9 households that were made up of unrelated people and 4 households that were made up of some sort of institution or another collective housing.
In 2000 there were 521 single family homes (or 77.5% of the total) out of a total of 672 inhabited buildings. There were 66 multi-family buildings (9.8%), along with 55 multi-purpose buildings that were mostly used for housing (8.2%) and 30 other use buildings (commercial or industrial) that also had some housing (4.5%). Of the single family homes 54 were built before 1919, while 85 were built between 1990 and 2000. The greatest number of single family homes (148) were built between 1981 and 1990.
In 2000 there were 947 apartments in the municipality. The most common apartment size was 5 rooms of which there were 290. There were 20 single room apartments and 472 apartments with five or more rooms. Of these apartments, a total of 873 apartments (92.2% of the total) were permanently occupied, while 41 apartments (4.3%) were seasonally occupied and 33 apartments (3.5%) were empty. As of 2009, the construction rate of new housing units was 2.5 new units per 1000 residents. The vacancy rate for the municipality, in 2010, was 2.28%.
The historical population is given in the following chart:
In the 2007 federal election the most popular party was the SVP which received 40.42% of the vote. The next three most popular parties were the CVP (17.09%), the SP (17.04%) and the FDP (15.77%). In the federal election, a total of 931 votes were cast, and the voter turnout was 57.0%.
As of 2010, Gretzenbach had an unemployment rate of 3.2%. As of 2008, there were 29 people employed in the primary economic sector and about 11 businesses involved in this sector. 436 people were employed in the secondary sector and there were 34 businesses in this sector. 239 people were employed in the tertiary sector, with 55 businesses in this sector. There were 1,271 residents of the municipality who were employed in some capacity, of which females made up 42.5% of the workforce.
In 2008 the total number of full-time equivalent jobs was 626. The number of jobs in the primary sector was 19, all of which were in agriculture. The number of jobs in the secondary sector was 415 of which 326 or (78.6%) were in manufacturing and 89 (21.4%) were in construction. The number of jobs in the tertiary sector was 192. In the tertiary sector; 85 or 44.3% were in wholesale or retail sales or the repair of motor vehicles, 12 or 6.3% were in the movement and storage of goods, 19 or 9.9% were in a hotel or restaurant, 2 or 1.0% were in the information industry, 1 was the insurance or financial industry, 9 or 4.7% were technical professionals or scientists, 21 or 10.9% were in education and 5 or 2.6% were in health care.
In 2000, there were 371 workers who commuted into the municipality and 1,042 workers who commuted away. The municipality is a net exporter of workers, with about 2.8 workers leaving the municipality for every one entering. Of the working population, 17.5% used public transportation to get to work, and 61.4% used a private car.
From the 2000 census, 1,008 or 42.1% were Roman Catholic, while 799 or 33.4% belonged to the Swiss Reformed Church. Of the rest of the population, there were 13 members of an Orthodox church (or about 0.54% of the population), there were 19 individuals (or about 0.79% of the population) who belonged to the Christian Catholic Church, and there were 88 individuals (or about 3.68% of the population) who belonged to another Christian church. There were 69 (or about 2.88% of the population) who were Islamic. There were 8 individuals who were Buddhist, 3 individuals who were Hindu and 4 individuals who belonged to another church. 305 (or about 12.75% of the population) belonged to no church, are agnostic or atheist, and 77 individuals (or about 3.22% of the population) did not answer the question.
The Wat Srinagarindravararam is named in honour of the Princess Srinagarindra, the mother of King Rama IX, who gave her personal permission for the temple to be named after her.
In Gretzenbach about 922 or (38.5%) of the population have completed non-mandatory upper secondary education, and 284 or (11.9%) have completed additional higher education (either university or a Fachhochschule). Of the 284 who completed tertiary schooling, 72.2% were Swiss men, 16.2% were Swiss women, 9.5% were non-Swiss men and 2.1% were non-Swiss women.
During the 2010-2011 school year there were a total of 215 students in the Gretzenbach 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 48 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 155 students in primary school and 12 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 Gretzenbach attend their school in a neighboring municipality.
As of 2000, there were 25 students in Gretzenbach who came from another municipality, while 127 residents attended schools outside the municipality.