Avoid Confusion
Knowing where to put commas in a sentence can be tricky, especially because seemingly similar-looking sentences require different comma usages. Oftentimes, it helps to verbalize the sentence out loud if you're not sure where the commas are supposed to go, listening to where you would naturally pause. In some instances, however, even that won't work.
Use Commas to Separate Independent Clauses
Normally, when there are only two pieces of a sentence connected by a conjunction like 'and,' you wouldn't need a comma in between them - as in, 'I like swimming through fire and juggling bobcats.' However, any time you have two independent clauses in the same sentence - an independent clause being a clause with at least one subject and one verb that can stand on its own as a sentence - they need more than just a comma to separate them. Instead, they have to be separated by either a semicolon, a colon, or a comma accompanied by a coordinating conjunction - as in, 'I like swimming through fire, but I love juggling bobcats.'
If you wrote:
I like swimming through fire, I love juggling bobcats.
you would be committing a grammatical error called a comma splice. However, add any comma plus a coordinating conjunction - you can use the mnemonic FANBOYS (for, and, nor, but, or, yet, and so) to remember which conjunctions are considered coordinating conjunctions - and you're all set.
- I ran to stop him, for he was letting the dragon level Tokyo.
Use Commas to Separate Non-Essential Elements
Sentences are made up of essential and non-essential clauses (another name for the main clause is the essential clause). When you've got a non-essential clause in a sentence, it needs to be offset with commas. Here's an example:
Jonathan, though he was destined to become King of the Spider-People, just wanted to be an accountant.
The middle part there, 'though he was destined to become King of the Spider-People,' can easily be pulled out of the sentence and the sentence will still make sense - that is, it would read, 'Jonathan just wanted to be an accountant.' Therefore that middle clause is non-essential, and it needs to have commas offsetting it on either side. A non-essential clause also can't stand on its own as a sentence, which is one way to help you decide whether it needs those commas or not.
You can also offset non-essential clauses with dashes, as in, 'Jonathan - though he was destined to become King of the Spider-People - just wanted to be an accountant.' It's the same rule, and it sounds pretty similar when I read it, except that the dashes pop the non-essential element out more for the reader and are therefore more appropriate when you want to highlight that a certain element or characteristic is particularly special.
Use Commas to Separate Contrasting Parts
You should also place a comma when two parts of the sentence contrast each other. This is a case where you don't need a conjunction or a semicolon to separate the clauses. For instance:
- He was laughing at you, not with you.
- The samurai was reserved, almost stoic.
Another special case like this is when you want to indicate a natural pause (this is the primary use of the comma and how it sounds in our speech, after all) - as in: 'You've been paying close attention to this lesson, haven't you?' You will need a comma when you ask a question at the end of a sentence in this manner.