The opening of the railway line Sulgen-Gossau in 1876 further expanded the local economy. Next to the textile industry in importance, agriculture remained important in the village. Towards the end of the 19th Century, the village made the transition from orchards and crops to livestock and dairy farming. The first dairy was built in 1909. Since the Brunschweiler Dyeing Factory ceased operations in 1984, Zetag AG operates the only textile production factory in the area. The construction of single family homes in the 1970s stopped the emigration of families from Hauptwil. It is now characterized by well-preserved old buildings and the now converted industrial landscape of the 17th to 19th Centuries and in 1999 was awarded the Wakker Prize.