The rules governing these two words are a bit flexible, but “which” is too often used where “that” should be. “That” is preferable when you are limiting or restricting a noun:
A law that does not have public support cannot be enforced. (“A law that” helps to limit the meaning to just one kind of law.)
The air dry loss moisture factor appears to control the amount of airborne respirable dust that is liberated from the product. (“Airborne respirable dust that” restricts the dust just to that liberated from the product.)
The following line from a nursery rhyme is instructive here, because all of the “thats” are correct:
This is the rat that ate the cat that lived in the house that Jack built.
In contrast, “which” introduces a phrase that provides descriptive yet incidental information, and “which” often requires commas on one or both ends of the phrase it introduces:
The law, which was enacted in 1897, was soon challenged by the courts.
Approximately 71 percent of the earth’s surface is covered by a worldwide body of sea water, which is interconnected.
The trawl consists of five net bags in a row which are collected on board one at a time as they become filled with oil.
In short, you use “that” to complete a noun and “which” simply to describe a noun.
Want more on :”that” vs “which”? Check out these entertaining websites: