Commas are used to set off elements that interrupt a sentence or that are not essential to a sentence.
Parenthetical and Transitional Expressions
Use commas around parenthetical and transitional expressions, including conjunctive adverbs and transitional phrases, that are in the middle or at the end of a sentence.
The contents of this chapter, from what I have seen, are a repetition of the last chapter.
I will, however, need to see your driver's license.
Celery, for example, contains fewer calories than what you burn eating and digesting it.
Certain transitional expressions do not always need a comma. If reading the sentence does not require a pause, no comma is used.
Perhaps we will visit the castle after all.
Use a comma to separate a noun of direct address from the rest of the sentence.
Rashad, are you feeling alright?
Are you, Nicholas, paying attention?
Use a comma to separate ending interrogative tags from the rest of the sentence.
You did read the book, didn't you?
Use a comma or a pair of commas with elements expressing sharp contrast. These contrasts often begin with not, never, and unlike.
Make sure you buy whole milk, not fat-free milk, or the recipe will not work.
My father, unlike my mother, loves to watch scary movies.
Most skateboarders, but not all of them, like to take risks.