
That and which can both introduce clauses that describe a noun. The main question is whether the clause identifies the noun or simply adds extra information about it.
In many style guides, particularly in American English, use that for a restrictive clause: information needed to identify the person or thing you mean. Do not place commas around this clause. For example, “The jacket that is hanging by the door is Sam’s” identifies one jacket among other possible jackets.
Use which for a nonrestrictive clause: extra information about a noun that is already clear. Set this clause off with commas. For example, “Sam’s jacket, which is hanging by the door, is still wet.” We already know which jacket the sentence means.
- “The files that are marked urgent need attention” means only the urgent files need attention.
- “The files, which are marked urgent, need attention” suggests that all the files are marked urgent.
The comma test is useful: remove the descriptive clause and check the result. If the sentence still points to the same specific noun, the clause is probably extra information and normally takes which with commas. If removing it changes which noun you mean, the clause is restrictive.
Restrictive which is also grammatical and is common in British English. However, following the that-for-restrictive and which-for-nonrestrictive pattern can make formal writing easier to interpret.

