Narrated by Ibn ‘Abbaas (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) enjoined zakaat al-fitr as purification for the fasting person from idle and obscene talk, and to feed the poor. Whoever pays it before the (Eid) prayer, it is a valid zakaat al-fitr.
Narrated by Abu Dawood (1609) and Ibn Maajah (1827)
Al-Bahooti (may Allah have mercy on him) said: The best is to pay zakaat al-fitr on the day of Eid before the prayer or around that time in a place where the Eid prayer is not offered, because the Prophet (blessings and peace of Allah be upon him) instructed that it should be paid before the people went out to prayer, according to the hadeeth of Ibn ‘Umar. Some said that it is best if it is paid when going out to the prayer place.