Use commas to separate independent clauses in a sentence, for example:
The game was over, but the crowd refused to leave.
Yesterday was her brother’s birthday, so she took him out to dinner.
Use commas after introductory words, phrases, or clauses that come before the main clause:
While I was eating, the cat scratched at the door.
If you are ill, you ought to see a doctor.
NOTE: You should not do the reverse of this. For example, the following two cases are wrong:
Introductory words that should be followed by a comma are: yes, however, and well. For example: Yes, you can come to the party
Use a pair of commas to separate an aside from the main body of the sentence. For example:
John and Inga, the couple from next door, are coming for dinner tonight.
You can test this by removing the aside from the sentence. If the sentence still reads correctly, you have probably used the commas as you should. In the case above, this would render: John and Inga are coming for dinner tonight.
Do not use commas to separate essential elements of the sentence. For example:
Students who cheat only harm themselves.
The baby wearing a yellow jumpsuit is my niece.
The Oxford Comma
I prefer the Oxford comma when dealing with lists. It is also known as the Serial Comma or the Harvard Comma. The Oxford comma is much more widespread in American English than British English. When using the Oxford comma, all items in a list of three or more items are separated. For example:
I love apples, pears, and oranges.
Note the comma after “pears”. Many people prefer not to use this style and will omit the final comma. We call this the Oxford comma because it is the standard method taught at Oxford University.
Use commas to set off all geographical names, items in dates (except the month and day), addresses (except the street number and name), and titles in names.
Birmingham, Alabama, gets its name from Birmingham, England.
July 22, 1959, was a momentous day in his life.
Occasionally, you will see a comma between a house number and street. This is not wrong, it is just old fashioned. It is not done in modern times, however.
Use a comma to shift between the main discourse and a quotation.
John said without emotion, “I’ll see you tomorrow.”
“I was able,” she answered, “to complete the assignment.”
Use commas if they prevent confusion:
To George, Harrison had been a sort of idol.