These are the basic comma rules. If you learn them or keep a copy of them with you whenever you write, you will solve 98% of your comma problems.
Put a comma before and, but, for, or, nor, so, and yet when they connect two independent clauses (sentences that can stand alone).
She hit the shot, and he cheered for her.
Separate three or more items in a series with a comma.
We want to protect cats, dogs, and horses.
Put a comma after an introductory word group.
Because I was hungry, I bought a hamburger.
Set off interrupters with pairs of commas, pairs of parentheses, or pairs of dashes.
The hamburger, hot and juicy, tasted great. The hamburger - which was hot and juicy - tasted great. The hamburger (made from ground beef and tofu) tasted great.
Put commas around the name of a person or group spoken to.
I hope, Carlene, that you're going with me.
Put commas around an expression that interrupts the flow of the sentence.
We took our fishing rods, therefore, and got into the boat.
0 Q, 109 A, 0 C