Thatis used for restrictive clauses.
Whichis used for nonrestrictive clauses.
The house thathas a big backyard is up for sale.The house, whichhas a big backyard, is up for sale.
Use of That
Here, the clause thathas a big backyard is a restrictive clause.
It is providing us an essential characteristic of the house, which sets it apart from the other houses.
Without this clause, we will not understand which house the person is talking about.
Use of Which
From this sentence, we understand that the person is just providing extra information through the nonrestrictive clause which has a big backyard.
It is useful, but not necessary.
Drop this clause, and the sentence would still mean the same in context.
Examples of Using Which
The unexpected package, whichhad no name, contained brand new shoes.His version of the story, whichI found convincing, was discredited by the jury.
American vs. British English
The distinction between which and that, as explained before, holds importance in American English.
However, people who use British English commonly use which for both, restrictive and nonrestrictive clauses.
Tip to Remember the Difference
I would say—Look for the clause!
If the clause talks about something essential, use that.
If not, go for which.