Commas are one of the most ubiquitous marks of punctuation; however, they are also often misused. While commas do help express the flow of a sentence, they are not breath marks. In general, commas are most often used to connect dependent (or subordinate) and independent (or main) clauses, to link phrases in a single sentence, and to set off additional information.
When to Use a Comma
Use a comma before a coordinating conjunction [and, but, or, nor, so, yet, and for] when the conjunction joins two independent clauses(an independent clause is a group of words that expresses a complete idea).
My sister had always been fascinated with dogs, but I was always more interested in cats because they seemed smarter.
However, you may omit the comma when the clauses are short.
My sister loves dogs but I love cats.
Commas are often used to separate dependent clauses from the main clause; therefore, you should use a comma after an introductory word or phrase.
After teasing the dog for half an hour, the boy was bitten.
Fortunately, the boy was not badly hurt.
However, the comma may be omitted after a short adverb clause or phrase if there is no danger of misreading.
In no time at all we understood the error of our grammatical ways.
Use commas to set off nonrestrictive elements, which include words or phrases that provide non-essential, additional information. While these “by the way” phrases may add important detail, they are not essential to the meaning of the main clause.
The mathematics professor, Dr Sally Smith, dazzled her class with her wit and insight.