When to use a comma before and or but

When two complete sentences are joined together using a conjunction (for, and, nor, but, or, yet, so), it should have a comma before it.

  • I have spoken to Sarah, and she has confirmed the dates.
    (I have spoken to Sarah. + She has confirmed the dates. Two simple sentences joined together with and.)

Compare:

  • I wanted to go to the beach, but I couldn’t afford to pay for a hotel room.
    (There should be a comma before but because I couldn’t afford to pay for a hotel room is a complete sentence.)
  • I wanted to go to the beach but couldn’t afford to pay for a hotel room.
    (There shouldn’t be a comma before but because couldn’t afford to pay for the hotel room is not a complete sentence.)