It follows a rise in attacks by the hardline Islamist group against government troops in recent weeks.
President Ashraf Ghani welcomed the announcement, and said his soldiers would respect the terms of the truce.
The three-day ceasefire is likely to raise hopes of a longer-term reduction in violence in the country.
But a similar ceasefire was announced for same festival in 2018 and was not extended.
“Do not carry out any offensive operations against the enemy anywhere. If any action is taken against you by the enemy, defend yourself,” Taliban spokesman Zabihullah Mujahid said on Saturday.
He added that the ceasefire had been declared solely for Eid al-Fitr, which marks the end of the holy month of Ramadan.
“I welcome the ceasefire announcement,” Mr Ghani wrote on Twitter shortly after. “I have instructed [the military] to comply with the three-day truce and to defend only if attacked.”
It is only the third time that the Taliban have declared a temporary truce since the conflict began.
The first was in 2018, again during Eid celebrations, and was a key moment in galvanising the peace process. Taliban fighters and members of the security forces hugged and posed for selfies together. That will not happen this time – the Taliban have ordered their members not to enter government territory.
Earlier this year, the group signed an agreement with the US setting out a timetable for the withdrawal of foreign forces from the country. But while they have stopped attacks against international troops they have continued targeting Afghan security forces.
Direct negotiations between the two sides were due to begin in March but have been delayed by a dispute over the exchange of prisoners and increased fighting. This brief reprieve in violence could help build momentum for those talks to finally start, and will revive some of the cautious hope Afghans had begun to feel: that an end to the conflict might eventually be possible. (Courtesy BBC)