There are some general rules which you can apply when using the comma.
Using the comma to separate phrases, words, or clauses in lists
A series of phrases
Use a comma + a little conjunction (and, but, for, nor, yet, or, so) to connect two independent clauses.
One of the most frequent errors in comma usage is the placement of a comma after a coordinating conjunction.
A series of nouns
Use a comma to set off introductory elements.
Use a comma to set off parenthetical elements
When both a city's name and that city's state or country's name are mentioned together, the state or country's name is treated as a parenthetical element.
When the state becomes a possessive form, this rule is no longer followed:
Also, when the state or country's name becomes part of a compound structure, the second comma is dropped:
A series of adjectives
e.g. She bought a bright red shirt.
A series of verbs
Use a comma to set off quoted elements. Because we don't use quoted material all the time, even when writing, this is probably the most difficult rule to remember in comma usage. It is a good idea to find a page from an article that uses several quotations, photocopy that page, and keep it in front of you as a model when you're writing. Generally, use a comma to separate quoted material from the rest of the sentence that explains or introduces the quotation:
If an attribution of a quoted element comes in the middle of the quotation, two commas will be required. But be careful not to create a comma splice in so doing.
Be careful not to use commas to set off quoted elements introduced by the word that or quoted elements that are embedded in a larger structure:
And, instead of a comma, use a colon to set off explanatory or introductory language from a quoted element that is either very formal or long (especially if it's longer than one sentence):
A series of clauses
Using the comma to enclose insertions or comments. The comma is placed on either side of the insertion.
Use the comma to mark off a participial phrase
Use the comma in 'tag questions'
Use to mark off interjections like 'please', 'thank you', 'yes', and 'no'
Use commas to set off phrases that express contrast.
Never use only one comma between a subject and its verb. "Believing completely and positively in oneself is essential for success."
Typographical Reasons: Between a city and a state [Hartford, Connecticut], a date and the year [June 15, 1997], a name and a title when the title comes after the name [Bob Downey, Professor of English], in long numbers [5,456,783 and $14,682], etc. Although you will often see a comma between a name and suffix — Bob Downey, Jr., Richard Harrison, III — this comma is no longer regarded as necessary by most copy editors, and some individuals — such as Martin Luther King Jr. — never used a comma there at all.
General notes:
1. Misplacing a comma can lose friends!
Putting a comma in the wrong place can lead to a sentence with a completely different meaning, look at these two examples: