It’s easy to get your head in a tailspin about that and which because the two certainly have commonalities. Most writers have difficulty when the words are used in relative clauses to define a noun.
That and which are both used as adjectives and pronouns. They are labeled "demonstrative" because they tell about a specific person, place, or thing. Let's take a look at how each is used in different situations.
As adjectives, that and which both describe a noun in a sentence.
That as an adjective indicates a specific item. It’s called a demonstrative adjective and describes one out of many.
- That cat over there.
That can also describe a remote time, place, or thought mentioned as opposed to this.
- This cat is mine, and that one is my brother's.
Which as an adjective is a determiner of one out of several. It’s also an interrogative, meaning it’s asked as a question.
- Which apple do you choose?
As pronouns, which and that represent objects, ideas, statements, and thoughts.
That refers to a person, place, thing, idea, etc. mentioned before:
- After that we rushed toward the woods.
Or it can mean one of two or more, implying a contrast to this:
- This story is more suspenseful than that.
Finally, it can be the object of a preposition when the preposition ends the sentence:
- The journalist that I spoke of.
Which as a pronoun indicates a preference choice:
- Which do you want?
Or can stand for whichever in a choice:
- Choose which kitten you like.
More About That
To get a little more advanced, that can serve as a conjunction or adverb.
As a conjunction, it is used to introduce an exclamation of strong feeling, as in Hamlet, Act I, Scene 2.
- O, that this too too solid flesh would melt thaw and resolve itself into a dew!
As an adverb it works like very to show a great extent:
- Marinating the hasenpfeffer for at least 24 hours is that important.
The Heart of the Matter
Writers often get confused and stumble when that and which are used in relative clauses. These are specific types of subordinate clauses that modify a noun. In other words, the clause adds information about the noun. The difference between using that or which in a relative clause boils down to whether or not the clause is restrictive.
A restrictive clause is necessary to the sentence. Use that.
- I want the basket that has the black kitten in it.
If there are lots of baskets, and only one black kitten, this is essential information to identify the correct basket.
A nonrestrictive clause adds to the sentence but is not essential to its meaning. Use which.
- The pears are in the bowl, which is red, on the counter.
There is only one bowl on the counter. We do not need to know it is red in order to identify the bowl. And, because the clause is like bonus information, an appositive, it is set off with commas. So additional but unnecessary information starting with which also requires commas.
Whew! That was a lot of grammar terms. The main thing to remember about using that or which in relative clauses is that is important to the sentence and which is extra.
If you want to dig deeper into grammar, consult a trusted reference book like The Elements of Style, The Chicago Manual of Style, or Writer's Guide and Index to English: Fourth Edition. ProWritingAid will help you check grammar, once your writing is done.