Answered by Shaykh Amjad Rasheed
Is it permissible for one with educational loans to give charity? Are there any other avenues that are forbidden for such a person to spend his money in?
It is permissible for a debtor to give some of his wealth in charity if:
1. he expects to be able to pay off his debt using his other wealth, and
2. the source [m: of this other wealth] is clear, such as him having a monthly salary.
As for if his giving charity would cause him to be unable to repay his debt, then it is forbidden for him in this case because using [m: his wealth] for payment of the debt is obligatory, which takes precedence over the recommended. Similar to this [m: i.e., payment of debts] is supporting one’s dependents: it is impermissible to give in charity that which one needs to support them, as explained in the Tuhfa, [m: a commentary] on the Minhaj (7.181).
(Translated by Moustafa Elqabbany)