Contractions generally sound a little more informal than their non-contracted equivalents. However, they also sound more natural, as non-contracted forms are practically never used in speech (except e.g. for emphasis or in cases where contractions are not grammatical).
Whether a particular piece of writing is "formal" enough to warrant avoiding contractions is really quite subjective. If you look at many scholarly books and even journal articles, you will find that many (native speaking) authors actually do use contractions and their respective editors have decided that they're happy with them. I would argue that contractions are almost always possible in e-mails: if the context was that formal, you probably wouldn't be communicating by e-mail in the first place. But as I say, it is a subjective decision.
On the other hand, if you are writing in a formal context such as a journal article or a formal letter to a company and can't decide whether or not to use contractions, then I think that avoiding contractions will always be a "safe" decision in such formal contexts.