German became an official language in Switzerland during the Middle Ages, when the area was part of the Holy Roman Empire. The German language was used in official documents and correspondence, and it was also the language of instruction in schools.
After the Swiss Confederation was formed in 1291, German continued to be used as the official language. However, the other languages spoken in Switzerland also gained official status over time. French became an official language in 1848, Italian in 1938, and Romansh in 1996.
Today, German is the official language in the northern and eastern parts of Switzerland, as well as in the canton of Graubünden. It is also the most commonly spoken language in the cantons of Bern, Solothurn, and Basel-Landschaft.