How can I know when should I use whether or if in a sentence? I can not see any difference between whether and if. When should I use each? For me, they are the same and I am not sure if there is a difference.
While they are almost interchangeable, there are indeed subtle differences:
'Whether' supports the conjunction 'or' for choice while 'if' traditionally does not, so although the sentences often seem to have the same meaning, you should use 'if' where the sentence is conditional and 'whether' where it presents two possibilities.
Tell me if you'll be in town at the weekend. - Here, you only need to notify the speaker if you do decide to go to town. "I will be in town at the weekend."
Tell me whether you'll be in town at the weekend (or not). - Here, whatever you choose to do at the weekend, you should tell the speaker. "I will/won't be in town at the weekend" (I prefer to include the 'or not', though some choose to elide.)
Also, a more modern answer might be that 'whether' is considered more formal, though I fear this may be in the same way 'whom' is considered by some more formal.
Hope that helps.
1. If (conditional clause) acts as an adverbial phrase meaning "in this case":
2. Whether (conditional clause with OR required) acts as an adverbial phrase meaning "in any case":
3. Whether (conditional clause with OR optional) can also act as a noun phrase meaning "this fact":
4. In less formal use, the use of whether as in (3) to create a noun phrase is often replaced by if:
Sometimes a single sentence could fit many or all of these uses, such as,
Whether implies both possibilities: the positive and negative answer, while the conditional if only supports or reaffirms the initial question.