Hochdeutsch (in its meaning Standard German) is not a very formal form of German but the written form. It's standardized by a joint commision made up by German, Austrian and Swiss officials. Local variations exist, especially Swiss German has a lot of unique expressions. German-speaking communities in Luxemburg and Belgium adopt the German standard. Liechtenstein adopts the standard in the Swiss German variety, and South Tyrol in Italy adopts the Austrian German standard.
Most people don't speak Hochdeutsch by default. Instead, they speak their local dialect and can switch to a spoken form of Hochdeutsch when they are talking to someone from a non-adjacent dialect or to foreigners. It often sounds very awkward and stiff when people do this.
There are exceptions, however: for example people from the Hannover-Braunschweig region speak a "dialect" nearly indistiguishable from Hochdeutsch. Many people in Berlin don't speak dialect either as there are a great number of speakers from other parts of Germany and people have to rely on Hochdeutsch to be understood by others. In the Hannover-Braunschweig region, the Ostfälisch dialect had died out already because of this.