Both whether and if are used to introduce indirect yes/no questions with little difference in meaning.
I don’t know if he will come. OR I don’t know whether he will come.
I asked if she was interested in the proposal. OR I asked whether she was interested in the proposal.
I am not sure if/whether I will have time.
After some verbs like discuss, whether is preferred to if.
We discussed whether we should accept the offer. (More natural than ‘We discussed if we should accept the offer’.)
Whether is also preferred in a two-part question with or. Note that if is also possible in most cases.
Let me know whether you can come or not. (‘Let me know if you can come or not’ is also possible.)
In fronted indirect questions whether is used.
Whether I can come I am not sure at the moment. (NOT If I can come I am not sure at the moment.)
After prepositions only whether is possible.
There was a big argument about whether we should buy a new car. (NOT There was a big argument about if we should buy a new car.)
I haven’t settled the question of whether I should quit the job. (NOT I haven’t settled the question of if I should …)
Before to-infinitives only whether is used.
They can’t decide whether to get married now or wait until they get to know each other well.
When the clause containing the question-word is a subject or complement, whether is normally preferred.
Whether we can continue like this is another matter. (Here the question-word clause ‘whether we can continue like this’ is the subject of the sentence.)
The question is whether she can meet the deadline. (Here the question-word clause ”whether she can meet the deadline’ is the complement of the subject.)