When a coordinating conjunction connects two or more independent clauses—word groups that could stand alone as separate sentences—a comma must be placed before the conjunction. There are seven coordinating conjunctions in English: and, but, or, nor, for, so, and yet.
A comma tells readers that one independent clause has come to a close and that another is about to begin.
EXCEPTION: If the two independent clauses are short and there is no danger of misreading, the comma may be omitted: The plane took off and we were on our way.
NOTE: As a rule, do not use a comma with a coordinating conjunction that joins only two words, phrases, or subordinate clauses. (See 31a. See also 30c for commas with coordinating conjunctions joining three or more elements.)