Praise be to Allah
Doing ghusl on Eid is mustahabb. It was narrated that the Prophet ﷺ did ghusl on the day of Eid.
It is better to do ghusl after the Fajr prayer, but if one does it before Fajr that is sufficient, because of the shortness of time available after Fajr, because the people need to go to offer the Eid prayer and the prayer place may be far away.
It says in al-Muntaqa Sharh Muwatta’ al-Imaam Maalik:
It is mustahabb to do ghusl just before going out to the prayer-place. Ibn Habeeb said that the best time to do ghusl for Eid is after praying Fajr. Maalik said in al-Mukhtasar that if one does ghusl for Eid before Fajr that is acceptable.
Ibn Qudaamah said in al-Mughni:
The time for ghusl (for Eid) is after the dawn comes, according to the apparent meaning of al-Khiraqi’s words. Al-Qaadi and al-Aamidi said: Ghusl before Fajr does not fulfil the Sunnah of doing ghusl, because the ghusl for a prayer should be done on that day and doing it before dawn does not meet that condition, as is the case with ghusl for Jumu’ah. Ibn ‘Aqeel said: What is mentioned in the texts from Ahmad is (that it may be done) before Fajr and after, because the time for Eid is more limited than the time for Jumu’ah, so if it is limited to the time after Fajr one may not be able to do it. And because the purpose behind it is to cleanse oneself, which may be achieved by doing ghusl at night because it is close to the time of prayer. But it is better to do it after Fajr, so as to avoid an area of scholarly dispute and to be more clean, because that is closer to the time of prayer.
Based on this, there is nothing wrong with doing ghusl for Eid before Fajr prayer if that will make it easier to go out to the Eid prayer.
And Allah knows best.
Read complete reply at islamqa.info