Coordinating conjunctions are used to join grammatically similar elements (two nouns, two verbs, two modifiers, two independent clauses, etc.).
The most frequently used are and, or, nor, so, but, for, and yet.
When a coordinating conjunction is used to join two independent clauses, you should use a comma before the coordinating conjunction. An independent clause contains a subject and a verb and could stand alone as a sentence.
- It rained for twenty days in a row, so it was no surprise when the river burst its banks.
Some writers may choose to omit the comma if the two independent clauses are short and well-balanced (about the same length).
- I like cheese but I don't like grapes.