The modern comma was invented by Aldus Manutius during the renaissance. His purpose was to clarify the sentence, though we have since slightly changed the comma's meaning. When it comes to placing commas nowadays, there are two general schools of thought: One uses them by ear, placing them where natural pauses occur in the sentence. The other uses them according to grammatical guidelines in order to clarify the structure and parts of a sentence. I hold to the grammatical perspective, because it is the only logical way to place commas. Placing commas by ear is subjective and thus prone to inconsistency. Without further ado, let's get to some examples.
Incorrect: I bought eggs ham bacon spam and eggs. He gave his paper to John, his teacher, Wallace, his father, and Bart, his friend.
Correct: I bought eggs, ham, bacon, spam, and eggs. He gave his paper to John, his teacher; Wallace, his father; and Bart, his friend.
Commas should separate independent clauses. An independent clause is one that contains both subject and predicate. In bastardized form, an independent clause could (sort of) stand as its own sentence.
Incorrect: I'm a student and he's a professor. We prepared dinner before sunset but we didn't eat until well after sundown.
Correct: I'm a student, and he's a professor. We prepared dinner before sunset, but we didn't eat until well after sundown.
Separate parenthetical statements within sentences with commas both before and after. You may hear parenthetical clauses referred to as non-restrictive clauses. It means the same thing. There is some confusion between that and which in relation to these clauses. They are technically interchangeable, but tradition has which reserved for non-restrictive clauses (parenthetical statements), while that reserved for restrictive clauses. For humans, use who.
Incorrect: The teacher an old and frail man struck his fist with great fortitude. The tree which stood at the corner, burnt down.
Correct: The teacher, an old and frail man, struck his fist with great fortitude. The tree, which stood at the corner, burnt down.
Separate an introductory clause with a comma. The New Yorker adds that no comma should come if the introductory clause follows a conjunction.
Incorrect: If two lights show strike by air. But if one light shows, strike by land.
Correct: If two lights show, strike by air. But if one light shows strike by land.
Greetings and closings follow with a comma.
Incorrect: Dear John (...) Sincerely
Correct: Dear John, (...) Sincerely,
Depending on how you write dates, you will need commas.
Incorrect: 21, September 1994. September 21 1994.
Correct: 21 September 1994. September 21, 1994.
Use commas in an address to separate street, city, and state.
Incorrect: 21 Maybury St. Cleveland Ohio.
Correct: 21 Maybury St., Cleveland, Ohio.