Before you get confused, let me explain what an independent clause is. An independent clause has both a subject and a predicate. It could stand by itself as a complete sentence (so it’s called independent).
A conjunction is a linking word used to connect words, phrases, clauses, or sentences. The conjunctions we’re talking about here are coordinating conjunctions, that link phrases of equal weight. They are the following: and, but, or, for, nor, so, yet. Here is an example.
He approached the counter, and the clerk told him the store was closed.
Both clauses– He approached the counter and the clerk told him the store was closed–are independent. Each one has a subject and predicate. Each one could stand on its own as a complete sentence. But instead they are joined with a conjunction, and. Therefore, according to our first rule, we need a comma before the and. Here are a few more examples.
The movie ended, but the audience didn’t leave.
He ate the entire cake, for he didn’t want to share it.
You can either go on the blind date, or you can sit home and mope.
One common error is to insert the comma even when there are not two independent clauses.
He went to the store, and bought a cake.
In this example, bought a cake is not an independent clause. It has no subject. It is a dependent clause. It cannot exist by itself. Therefore there should be no comma.
A complication occurs when the second independent clause begins with an introductory element. For example,
We went to the movies, and after that, we went to dinner.
Again, we have two independent clauses, We went to the movies and we went to dinner. They are joined by a conjunction, and. But the second clause begins with an introductory element, after that. You may be tempted to put a comma after and. Don’t do it. We still need the comma before and, as we’ve discussed above. And to set this introductory element apart, a comma after that is sufficient.