When should 'which' be used instead of 'that' in a sentence?

use "that" when the meaning of the sentence changes. Sometimes "that" can be left out of the sentence. Never use a comma with "that". Use "which" when the meaning of the sentence does not change. Always use a comma with "which".