Here's why:
* Independent Clauses: An independent clause is a group of words that can stand alone as a complete sentence.
* Conjunction: "But" is a coordinating conjunction, which connects words, phrases, or clauses of equal grammatical rank.
Example:
* Correct: I went to the store, but I forgot to buy milk.
* "I went to the store" and "I forgot to buy milk" are both independent clauses.
* The comma before "but" separates the clauses.
However, there are a few exceptions:
* Short, Simple Clauses: If the clauses are very short and simple, you may omit the comma.
* "I tried but failed."
* Parenthetical Phrases: If "but" introduces a parenthetical phrase (a phrase that could be removed without changing the meaning of the sentence), you may omit the comma.
* "I would go, but I'm busy."
In doubt? It's always safer to use a comma before "but."