Praise be to Allah.
It is better to give obligatory zakah openly and announce it, so that others will follow one’s example, lest one be thought badly of and some people think that this person is not paying zakah.
But if a person fears that he will be showing off, or he fears that it may cause some hurt and embarrassment to the poor person, then it is better to give it in secret.
It is possible to combine both interests, by giving some zakah openly and giving some secretly, according to circumstances.
Al-Nawawi (may Allah have mercy on him) said:
“It is better, in the case of zakah, to give it openly, so that others will see it and do likewise, and lest one be thought badly of. This is the same as obligatory prayer: it is recommended to do it openly. It is only recommended to conceal in the case of nafl prayers and fasts.” (Al-Majmu‘, 6/228)
Al-Mardawi said in al-Insaf (3/200): “It is recommended to pay zakah openly in all cases, according to the correct view.”
Ibn Battal said in his commentary on Sahih al-Bukhari, 3/420: “There is no difference of opinion among the leading scholars: giving obligatory charity openly is better than doing it secretly, and giving voluntary charity in secret is better than giving it openly… The same applies to all kinds of obligatory and nafl actions. Sufyan said: “‘but if you conceal them and give them to the poor, that is better for you” [al-Baqarah 2:271], except zakah. This view is like consensus.”
It says in al-Mawsu‘ah al-Fiqhiyyah (23/301), concerning matters to which attention should be paid when giving zakah:
“Paying zakah should be done openly and announced. … al-Tabari said: The scholars agree that doing obligatory acts openly is better.”
With regard to the verse in which Allah says (interpretation of the meaning): “If you disclose your Sadaqat (almsgiving), it is well; but if you conceal them and give them to the poor, that is better for you” [al-Baqarah 2:271], this has to do with voluntary charity , and is like prayer: offering voluntary prayers at home is better, and offering obligatory prayers in the mosque with the congregation is better.”
And Allah knows best.