1. In a list of three or more items:
* You need a comma before "and":
* "I went to the store to buy apples, bananas, and oranges."
* "She loves to read, write, and paint."
2. When joining two independent clauses:
* You need a comma before "and":
* "The sun was shining, and the birds were singing."
* "I finished my homework early, and I went to the park."
3. When "and" is used to join two words or phrases:
* You don't need a comma before "and":
* "She has a cat and a dog."
* "The book was long and boring."
Here's a simple rule of thumb:
* If "and" joins two complete sentences (independent clauses), use a comma before it.
* If "and" joins words or phrases, or is part of a list, don't use a comma before it.
Exceptions:
There are exceptions to these rules, but they are less common.
Example:
* "He was tired and hungry, and he wanted to go home."
In this case, the second "and" is used to join two complete sentences, but it's preceded by a comma because the first part of the sentence is a longer phrase.
If you're unsure whether or not to use a comma, it's always best to consult a style guide or grammar resource.