Commas should be used:
1) Before a coordinating (FANBOYS) conjunction used to join two independent clauses
An independent clause is simply a group of words that contains a subject and a verb, and that can stand on its own as a sentence.
The dog ran across the yard.
My chemistry teacher’s tests are challenging.
London is a very old city.
Coordinating conjunctions are used to join independent clauses to one another. These conjunctions are also known by the acronym FANBOYS: For, And, Nor, But, Or, Yet, So.
When a coordinating conjunction is used to separate independent clauses, a comma should be placed before the conjunction.
The dog ran across the yard, and then he walked into the house.
My chemistry teacher’s tests are challenging, so I have to study hard for them.
London is a very old city, but it contains some modern sections.
Note, however, that when the subject is not repeated in the second clause no comma is necessary.
The dog ran across the yard and then walked into the house.
London is a very old city but contains some modern sections.
In real life, this rule is somewhat flexible. Commas are often used in this situation in order to break up long sentences, or for the sake of clarity.
2) Between a dependent clause or fragment and an independent clause
A dependent clause cannot stand on its own as a sentence. Many dependent clauses begin with subordinating conjunctions (the most common ones include because, while, whereas, although, when, if, unless, until), while others begin with participles, i.e. -ING words.
Having run across the yard
Because my chemistry teacher’s tests are challenging
Although London is a very old city
When a dependent clause is added to an independent clause to form a sentence, a comma is always required when the dependent clause comes first.
Having run across the yard, the dog walked into the house.
Because my chemistry teacher’s tests are challenging, I have to study hard for them.
Although London is a very old city, it contains some modern sections.
When the independent clause comes first, things get a little fuzzier. A comma must be used to set off -ING phrases and is typically used before “strong” transitions such as although and whereas.
The dog walked into the house, having run through the muddy yard.
London is a very old city, although it contains some modern sections.
When it comes to other conjunction such as because and when, the use of a comma depends on the circumstances. In many instances, the use of a comma results in an unnecessary or illogical break between parts of a sentence. In some cases, however, a break may be necessary for the sake of logic or clarity, or to break up a very long sentence.
Compare
No comma: We saw Parliament and Hyde Park when we visited London.
Comma: The English Civil Wars were fought between supporters of the King and supporters of Parliament in the mid-seventeenth century, when conflicts over the manner of England’s government erupted into open warfare.
3) Around non-essential words and phrases
A non-essential clause (also known as a non-restrictive or parenthetical clause) is a clause that can be removed from a sentence without affecting its essential meaning.
These clauses must be set off by two commas: one before, one after. In many cases, non-essential clauses begin with “w-words” such as which and who, but they can also begin with nouns (appositives) or with -ING words.
The dog, which had just run through the muddy yard, walked calmly into the house.
The dog, having run through the muddy yard, walked calmly into the house.
London, a city that was founded over 1,000 years ago, contains some modern sections.
Note that states and countries should also be surrounded by commas when they appear after city names. The same is true for years that appear after specific dates.
We visited my grandparents in Cincinnati, Ohio, last summer.
The Declaration of Independence was ratified on July 4th, 1776, by the Second Continental Congress.
4) After introductory words and phrases
Introductory words and short phrases at the beginning of a sentence should always be followed by commas.
Last week, my dog escaped from his leash and ran into my neighbor’s muddy yard.
London has a reputation for being rainy; however, it typically receives less precipitation than Rome, Paris, and even Naples do.
London is a very old city. In fact, it has been a major urban center since the eleventh century.
5) Between items in a list (serial comma)
Note that a comma before the last item (the “Oxford comma”) is generally optional. For example, the sentence below can be correctly written two ways:
London’s most famous attractions include Westminster Abbey, Buckingham Palace, and The Tower of London.
OR:
London’s most famous attractions include Westminster Abbey, Buckingham Palace and The Tower of London.
In some cases, however, a comma before the last item may be necessary for logic or clarity. Compare the following two versions of this sentence:
The food shipping company’s overtime rules do not apply to the canning, processing, preserving, freezing, drying, marketing, storing, packing for shipment or distribution of agricultural produce or perishable foods.
The food shipping company’s overtime rules do not apply to the canning, processing, preserving, freezing, drying, marketing, storing, packing for shipment, or distribution of agricultural produce or perishable foods.
The lack of a comma in the first version implies that overtime rules do not apply only to packing that is done for shipment or distribution of particular food types.
In contrast, the comma in the second version implies that overtime rules do not apply to either packing or distribution of particular food types.
In this case, it’s a significant distinction. In fact, it turned the sentence into the subject of a lawsuit.
6) Between adjectives whose order could be reversed, or that could be separated by the word and
When a pair of adjectives could be presented in either order, or would sound equally correct with the word and between them, a comma should be used.
London is a large, bustling urban center. (London is a large and bustling urban center.)
London is a diverse, bustling city. (London is a bustling, diverse city.)
Commas should not be used
1) Between subjects and verbs
Incorrect: London and Paris, are two of the most popular tourist destinations in the world.
Correct: London and Paris are two of the most popular tourist destinations in the world.
Note that this rule holds true even when subjects are very long.
Incorrect: One of the factors that separates London from other European capitals, is its linguistic diversity: over 300 languages are spoken in the city.
Correct: One of the factors that separates London from other European capitals is its linguistic diversity: over 300 languages are spoken in the city.
2) Between compound noun (subjects or objects)
A compound subject or object simply consists of two nouns joined by the word and.
Incorrect: London, and Paris are two of the most popular tourist destinations in the world.
Correct: London, and Paris are two of the most popular tourist destinations in the world.
Incorrect: One of my goals is to visit both London, and Paris.
Correct: One of my goals is to visit both London and Paris.
3) Between adjectives, when one modifies another
Incorrect: The London Tube is the oldest, underground railway network in the world.
Correct: The London Tube is the oldest underground railway network in the world.
4) Before or after a preposition
Preposition are “location” and “time” words: they indicate where things are, where they are going, and when they happened. The most common ones include to, from, for, of, by, with, in, on, about, between, and around.
Incorrect: The London Tube is the oldest underground railway network, in the world.
Correct: The London Tube is the oldest underground railway network in the world.
5) Before or after the word that
Incorrect: The London Tube is a public rapid transit system, that serves the city of London and some parts of the adjacent counties of Buckinghamshire, Essex and Hertfordshire.
Correct: The London Tube is a public rapid transit system that serves the city of London and some parts of the adjacent counties of Buckinghamshire, Essex and Hertfordshire.