Which and that are difficult to learn for anyone studying English as a second language because no one, not even people who should know better, gets it right!
It all has to do with restrictive (or defining) phrases and clauses.
You use that to introduce a restrictive phrase or clause that describes a place or thing. Another term for restrictive is "defining". "Defining" is an easier way to remember the rule. Defining phrases and clauses add ESSENTIAL detail to a sentence. They are never introduced with a comma, because they are essential to the description.
For example:
A: Which briefcase belongs to you? B: The briefcase that is marked "KF" belongs to me. |
Note: "that is marked" describes the briefcase.
Which introduces unrestricted or undefining phrases and clauses. These phrases add EXTRA detail that you can omit without changing the sentence. They are introduced and concluded with commas.
For example:
A: Tell me about the book you read. B: The book, which I got from the library last week, is a very exciting mystery. |
Note: "which I got from the library" is an unnecessary detail.