- Use a comma before which when it introduces a nonrestrictive phrase.
- Don’t use a comma before which when it’s part of a prepositional phrase, such as “in which.”
- Don’t use a comma before which when it introduces an indirect question.
Comma Before Which in Nonrestrictive Phrases
A nonrestrictive phrase adds a little bit of extra (but not essential) information about a noun phrase that you’ve already mentioned in your sentence.
In the sentence above, which introduces a nonrestrictive phrase (highlighted in gray). Therefore, you need a comma before which and another one at the end of the nonrestrictive phrase. How can you tell that it’s a nonrestrictive phrase? Try taking it out of the sentence.
The meaning of the sentence didn’t change—it just contains slightly less detail now. You’re still talking about Jeff’s new car.
If a phrase is restrictive instead of nonrestrictive, it means that you can’t take it out of the sentence without changing the meaning. Restrictive phrases are usually introduced by that instead of which, especially in American English.
The highlighted phrase in the sentence above is restrictive. If you try taking it out of the sentence, the meaning changes: Cars always seem to break down. You’re not talking about cars in general; you’re specifically talking about the cars that Jeff buys. That means the phrase is restrictive and you should not use commas with it.
Here are a few more examples of sentences that require a comma before which:
Which in Prepositional Phrases
You don’t need a comma before which when it’s part of a prepositional phrase such as of which, in which or on which.
Which in Questions
You don’t need to use a comma before which when it introduces a question. That’s not much of a problem for direct questions, since which is usually the first word:
But when a sentence contains an indirect question, which might not be the first word. Either way, you don’t need to put a comma before it.
from Grammarly Blog https://www.grammarly.com/blog/comma-before-which/