It can be confusing to decide when to use that and when to use which. If you use British English, scroll to the end of this post. If you use American English, here's a quick guide to help you know the difference:
When dealing with people, you use neither that nor which. You use who. For example:
X The journalist that revealed the government's plans has not been heard from since Tuesday.
X The journalist which revealed the government's plans has not been heard from since Tuesday.
✓The journalist who revealed the government's plans has not been heard from since Tuesday.
For all other things, use that when the clause that follows is essential to the meaning of the sentence. For example:
X The law criminalizes speech which criticizes the government
✓ The law criminalizes speech that criticizes the government.
An easy way to check if the clause is essential is to eliminate it and see if the meaning of the sentence changes. So our sentence above would become "The law criminalizes speech." Has the meaning changed? Yes. This previous sentence says the law criminalizes a specific type of speech, but now it says that it criminalizes all speech.
Use which when the clause that follows is not essential to the meaning of the sentence. For example:
X Many digital rights groups have slammed the law, that goes into effect next week.
✓ Many digital rights groups have slammed the law, which goes into effect next week.
We can check if the clause is not essential by eliminating it and seeing if the meaning of the sentence changes. So our sentence above would become "Many digital rights groups have slammed the law." Has the meaning changed? No.
In British English, however, there are slightly different rules.
That can be used instead of who when you are referring to people in an unspecific way. For example:
-The police are looking for someone that knows about the case.
For clauses that are essential to the meaning of the sentence, that and which are both acceptable. So according to British English, both versions of the original example above are correct:
✓ The law criminalizes speech which criticizes the government.
✓ The law criminalizes speech that criticizes the government.
BUT American English and British English agree that you cannot use that when the clause is not essential to the meaning of the sentence. So the original example of this above remains correct:
X Many digital rights groups have slammed the law, that goes into effect next week.
✓ Many digital rights groups have slammed the law, which goes into effect next week.