If you disclose your charitable expenditures, they are good; but if you conceal them and give them to the poor, it is better for you, and He will remove from you some of your misdeeds [thereby]. And Allāh, of what you do, is [fully] Aware.
Allah states that He has perfect knowledge of the good deeds performed by all of His creation, such as charity and various vows, and He rewards tremendously for these deeds, provided they are performed seeking His Face and His promise. Allah also warns those who do not work in his obedience, but instead disobey His command, reject His revelation and worship others besides Him:
وَمَا لِلظَّـلِمِينَ مِنْ أَنصَارٍ
(And for the wrongdoers there are no helpers.) meaning, who will save them from Allah's anger and torment on the Day of Resurrection.
The Virtue of Disclosing or Concealing Charity
Allah said,
إِن تُبْدُواْ الصَّدَقَـتِ فَنِعِمَّا هِىَ
(If you disclose your Sadaqat, it is well) meaning, "It is well if you make known the charity that you give away."
(5) Verse 271: إِن تُبْدُوا الصَّدَقَاتِ فَنِعِمَّا هِيَ (الی قولہ) وَاللَّـهُ بِمَا تَعْمَلُونَ خَبِير : "If you give the alms openly, it is good enough, ... and Allah is All-Aware of what you do"
Obviously, this verse covers all types of charity, whether obligatory or supererogatory, and it is more preferable to perform all of them as secretly as possible. To observe secrecy in a charitable act has religious merits, because it is far from the possibility of riya' ریاء (show off), and more graceful for the receiver who can feel shy about receiving charity in public. It is also beneficial from an earthly point of view, because it does not disclose the amount of wealth one owns.
It should, however, be kept in mind that the preferability of observing secrecy is a matter of principle. There may be situations where it becomes more preferable to perform an act of charity openly for some external reasons, such as removing some accusation (of not paying زکاۃ Zakah, for instance) or to persuade others to follow the example. Such exceptional cases do not negate the basic principle in any way.
Immediately after the instruction of concealing the 'Sadaqat صداقات ', the holy verse says, وَيُكَفِّرُ عَنكُم مِّن سَيِّئَاتِكُمْ (This will write off part of your sins). It does not mean that the expiation of evil-deeds is confined to the charity made in secret only. In fact, a charity made in public also carries the same benefit. But the reference to expiation here is in the context that even if someone feels a secret charity as useless in this world, he should not feel depressed, because Allah will forgive his sins, and that is a great gain for him.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 268–271
There are two ways of spending one’s earnings in this world. One is to spend in ways shown by Satan. Another is to spend in ways shown by God. What Satan does is to impress on the minds of human beings the importance of personal requirements, and bring about conviction that all their earnings are best spent on personal comforts and luxuries. When Satan sees that any individual has more wealth than is necessary for his personal needs, he kindles in him another desire, that of indulging in showy activities. At the instigation of Satan, man spends all his money on ostentatious living and feels happy that he has spent his money in the best possible way. What is desired of man is that he should not regard his wealth as his personal possession but rather as something that belongs only to God. He should spend as much of his wealth as is necessary for his actual needs and the rest he should spend on achieving higher goals. He should give this surplus wealth to the weaker of God’s servants and also spend for the cause of God’s religion. When he spends for the weaker section of society, he hopes that in the Hereafter, when he appears empty-handed before God, he will not be deprived of God’s blessings. Similarly, when he spends his wealth for the cause of God’s religion, he allies himself with God’s mission.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.