Summarize this article:

If you determine that omitting the clause changes the meaning of the sentence, you need to use "that" in your sentence. For example, in the sentence "I like dogs that are brown," the clause "that are brown" is crucial to understanding the sentence; it limits what type of dogs you like. If omitting the clause only removes additional information from the sentence, you need to use "which" in your sentence. For example, in the sentence "I took the firetruck, which is my niece's favorite toy, to be fixed," the clause "which is my niece's favorite toy" only adds information to the sentence. You're taking the firetruck to be fixed the fact that the truck is your niece's favorite doesn't change the meaning of the sentence. If you're creating a non-restrictive clause and therefore using "which" in your sentence, the clause should usually be surrounded by commas. In some cases, though, you may also use dashes or parentheses to separate a non-restrictive clause. For example, "I love lobster, which is expensive, because it reminds me of growing up by the ocean," would still have the same meaning without "which is expensive." Therefore, "which is expensive" is the phrase you should surround with commas. If you know you have a non-restrictive clause and need to use "which," but don't know where to put the commas, test it. Your sentence should still make sense if you take out the words surrounded by commas.
Use "that" for restrictive clauses. Use "which" for non-restrictive clauses. Determine where you should place commas.