Cherry is right. There is a lot more, that makes speaking formal or less formal, than the German "Du" or "Sie". In common situations, e. g. when you deal with unknown persons, you will try to demonstrate modesty and politeness. Thus it is a good practice to excuse yourself, before you ask a question, and to explicitly say "please" and "thank you", wherever possible. And of course you will (try to) use the "Sie" in its correct grammer (as Falk explaned), as long as you don't know whether the person, you are addressing, might accept the "Du". (Robert is right, there are more and more situations where "du" is accepted, however you shouldn't try to find that out with the first phrase you say.)
Apart from that, there are a lot of different sorts of formal German, e. g. in written contracts, laws, official documents and in the vokabulry of certain professions (the so called "Fachchinesisch" = "professional Chinese", meaning that it is hard to understand for outsiders)..