Trimbach is a municipality in the district of Gösgen in the canton of Solothurn in Switzerland. Trimbach is first mentioned in 1244 as Trinbach. Trimbach has an area, as of 2009, of 7.62 square kilometers. Of this area, 1.77 km² or 23.2% is used for agricultural purposes, while 3.99 km² or 52.4% is forested. Of the rest of the land, 1.81 km² or 23.8% is settled, 0.08 km² or 1.0% is either rivers or lakes.