In a defining clause, use that. In non-defining clauses, use which. If you can remove the clause without destroying the meaning of the sentence, the clause is nonessential and you can use which.
For example. My bike that has a broken seat is in the garage.In this sentence, you understand that the speaker has at least one other bike.
My bike, which has a broken seat, is in the garage.
Here, the broken seat is simply a description of the bike in the garage. There’s no implication that the speaker owns more than one bike.
i found this explanation on the Internet.