Short answer
Yes, as long as it does not stop you paying debts that are due. Repaying a debt you owe now comes before voluntary charity, because it is someone else's right. Small charity is still fine, and a long-term debt like a mortgage being paid on time does not stop you giving. Zakat has its own rules on debt.
Repaying a debt that is due is fard; voluntary sadaqah is recommended. Giving sadaqah in a way that delays a due debt the lender is asking for is not allowed. Debts being paid on schedule do not prevent sadaqah.
The four schools agree on this.
Explanation
Debt is a right of another person, and charity is a favour you choose to do. When the two clash, the right comes first. The Prophet ﷺ said the best charity is from what is spare, and Imam al-Bukhari named a chapter to say that whoever gives charity while he or his family are in need, or while he owes a debt, should know the debt has more right to be paid. Delaying a debt you can pay is itself a wrong.
In practice:
- A debt that is due now, such as a loan the lender is asking for or an overdue bill: pay it before giving large sums in charity.
- A long-term debt being paid on schedule, such as a mortgage or student loan: you may give charity freely.
- Small daily charity, a meal, a few coins or a kind act, is fine in every case.
- Debts carrying interest that grows: clearing them quickly also protects you from more sin.
Abu Bakr once gave all he had, and the Prophet ﷺ accepted it, but that was from a man of exceptional trust in Allah whose family's needs were met. Most people are told to keep enough for their duties.
Zakat is different: it is not voluntary, and debts affect it in a set way; see do debts reduce your zakat. If debt is weighing on you, see the dua for debt relief. The four schools agree that a due debt comes before voluntary charity.
The evidence
Quran, Surah Al-Baqara 2:219
۞ يَسْـَٔلُونَكَ عَنِ ٱلْخَمْرِ وَٱلْمَيْسِرِ ۖ قُلْ فِيهِمَآ إِثْمٌۭ كَبِيرٌۭ وَمَنَٰفِعُ لِلنَّاسِ وَإِثْمُهُمَآ أَكْبَرُ مِن نَّفْعِهِمَا ۗ وَيَسْـَٔلُونَكَ مَاذَا يُنفِقُونَ قُلِ ٱلْعَفْوَ ۗ كَذَٰلِكَ يُبَيِّنُ ٱللَّهُ لَكُمُ ٱلْءَايَٰتِ لَعَلَّكُمْ تَتَفَكَّرُونَ ﴿٢١٩﴾
They ask you about wine and gambling. Say, "In them is great sin and [yet, some] benefit for people. But their sin is greater than their benefit." And they ask you what they should spend. Say, "The excess [beyond needs]." Thus Allah makes clear to you the verses [of revelation] that you might give thought.
Voluntary spending comes from what is beyond one's needs and duties.
Sahih al-Bukhari 1426
Sahih... خير الصدقة ما كان عن ظهر غنى وابدأ بمن تعول ...
"The best charity is that given from what is spare, and begin with those you support."
Charity comes from the surplus, after duties.
Sahih al-Bukhari 2287
Sahih... مطل الغني ظلم فإذا أتبع أحدكم على ملي فليتبع ...
"Delay in paying a debt by someone who is able to pay is injustice."
Paying what you owe on time is an obligation.
Sahih al-Bukhari 2387
Sahih... من أخذ أموال الناس يريد أداءها أدى الله عنه ...
"Whoever takes people's money intending to repay it, Allah will repay it for him."
A sincere intention to repay brings Allah's help.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.