back-to-school The real difference between that and which

"That" and "which" are imprecise words by design. They're convenience terms to help ideas flow smoothly through efficient English.

A common mistake in writing is confusion between the use of "that" and "which." Both are "determiner" pronouns, because they both refer back to a concept that's already been stated in a sentence and usually leads to further information about it. In many ways, they are at least conceptually interchangeable, but grammatically there are conventions for how each one is used.

The rule is to use "which" after a comma, and "that" where no comma is required.

To make sense of this rule, though, you need to understand when to use a comma in a sentence.

What does a comma do?

A comma serves many purposes, but the most common is to divide a sentence into clauses. Suppose someone had written this sentence:

The Encryption Widget is an entity running inside the Lock Module, and the Lock Module connects to the Key Server to perform verification.

That's a long sentence, and long sentences can be hard to parse. One fix for this is to split it into two sentences at the comma:

The Encryption Widget is an entity running inside the Lock Module. The Lock Module connects to the Key Server to perform verification.

But suppose you prefer to write it as one sentence, for whatever reason. To simplify the single sentence, you can use a pronoun in place of the second occurrence of "Lock Module". You can drop the comma and use "that":

The Encryption Widget is an entity running inside the Lock Module that connects to the Key Server to perform verification.

Or you can keep the comma and use "which":

The Encryption Widget is an entity running inside the Lock Module, which connects to the Key Server to perform verification.

Functionally, the result is the same, but in modern English there are some subtle implications for each choice.

Implications of "that" and "which"

In modern English, the word "that" is often interpreted as implying specificity. The phrase "click the button that has a circle icon on it" implies that there are several buttons, and only one with a circle icon on it. The phrase "click the button, which has a circle icon on it" implies that there is only one button (and it happens to have a circle icon on it).

Consider the example phrase using "that":

The Encryption Widget is an entity running inside the Lock Module that connects to the Key Server to perform verification.

To many readers, this implies that the Encryption Widget runs only inside one specific Lock Module (specifically, the one that connects to the Key Server).

The example phrase written with "which" reads a more general and abstract statement. The Encryption Widget runs inside any given Lock Module, and it so happens that Lock Modules connect to Key Servers by nature.

Using "which" incorrectly

The word "which" is rarely correct without a preceding comma. Although it's functionally (if not semantically) interchangeable with "that", it does require a new clause.

This is incorrect because there is no comma:

The Encryption Widget is an entity running inside the Lock Module which connects to the Key Server to perform verification.

Shorter sentences are easier to parse

When in doubt, try splitting the sentence. Both "that" and "which" are often transitional devices used to combine sentences that don't necessarily need to be combined. I appreciate the convenience of pronouns as much as everyone else, but I admit that pronouns are not obviously specific.

It's difficult to tell, sometimes, what "that" refers to in a complex sentence. Are you confident that the author of my example phrase means that the Lock Module connects to the Key Server? Maybe the author actually meant to say that the Encryption Widget connects to the key server.

You can clear up potential confusion by simplifying a long sentence, and the easiest way to simplify is to split it:

The Encryption Widget is an entity running inside the Lock Module. The Lock Module connects to the Key Server to perform verification.

Now there's no question about what connects to the Key Server.

That and which

"That" and "which" are imprecise words by design. They're convenience terms to help ideas flow smoothly through efficient English. However, they can be confusing. The rule to remember is that "which" requires a comma. When in doubt, though, you can probably just split the sentence into two.