Here's why:
* Independent clause: A complete sentence with a subject and verb that can stand alone.
* Conjunction: A word that connects words, phrases, or clauses.
* Coordinating conjunctions: These connect words, phrases, or clauses of equal grammatical rank. Some common ones are "and," "but," "or," "for," "nor," "so," and "yet."
Example:
* I went to the store, but I forgot to buy milk.
"I went to the store" is a complete sentence.
"I forgot to buy milk" is a complete sentence.
"But" connects the two complete sentences.
When not to use a comma:
* When "but" is connecting two phrases or a dependent clause and an independent clause:
* Example: I'm tired, but I want to go out. (This is a dependent clause and an independent clause.)
In summary:
* Use a comma before "but" when it joins two independent clauses.
* Do not use a comma before "but" when it joins a dependent clause or phrase to an independent clause.