Some uses of these words are obvious (e.g., Which one should you use?”), but others are more nebulous (e.g., Pick the one that/which is right!) (Note: In British English, the distinction between that and which is less clear, but we follow U.S. usage.)
Use that for so-called essential clauses — that is, essential to the meaning of a sentence — and without commas.
YES: The sandwich that I want is not available today.
NO: The sandwich which I want is not available today.
PROBABLY NOT: The sandwich, which I want today, is not available.
(This last one sort of makes sense, but the emphasis is likely wrong. You’d use this only if you were casually noting that you wanted the sandwich, rather than specifying which sandwich is not available.)
Use which for nonessential clauses, and add commas. If you can remove the clause enclosed in commas without losing the meaning of the sentence, use which. Otherwise, use that.
YES: The grilled-cheese sandwich, which comes with tomato soup, is not available today.
Here, you can see that if we remove “which comes with tomato soup,” the sentence still makes sense: The grilled-cheese sandwich is not available today.
NO: The grilled-cheese sandwich which comes with tomato soup is not available today.
PROBABLY NOT: The grilled-cheese sandwich that comes with tomato soup is not available today. (This would mean there’s only one sandwich that comes with tomato soup, and it’s not available today.)
Can you tell that I wrote this while I was hungry? I want a sand-WHICH now. Sorry, I know that was cheesy.