Formerly means previously: "the building was formerly a school." Formally means in an official or proper way: "she was formally introduced." They differ by a single letter and share no meaning at all, which is why the mistake survives spellcheck — both are real words, so nothing flags the swap.
The core difference
Formerly is about time — it points backwards. Formally is about manner — it describes how something was done. There is no overlap; the confusion is purely visual.
Seeing them side by side
- formerly = previously: Formerly known as Bombay.
- formally = officially, properly: Formally dressed. / Formally approved by the board.
Why spellcheck will not save you
Both spellings are valid words, so a swap produces a sentence that is grammatical and wrong: "the merger was formerly approved" reads as though the approval happened at some unspecified point in the past, rather than officially. It is a mistake that reaches print easily.
A check that works
Substitute previously. If the sentence still means what you intended, you want formerly. If it does not, try officially — if that fits, you want formally. The two substitutions never both work.