The attack took place as the students – thought to be mainly girls – were leaving the Kabul school.
A blast close to a secondary school in the Afghan capital Kabul has left at least 25 people dead and dozens more injured, officials have said.
The explosion took place as students were leaving the building on Saturday, with pictures on social media showing abandoned school bags in the street, according to BBC correspondents.
Most of those hurt were girls, a Ministry of Education spokeswoman said.
No one has admitted carrying out the attack.
Dasht-e-Barchi – an area in the west of Kabul where many Shiite Hazaras live – has often been targeted by Sunni Islamist militants.
Almost exactly a year ago, a maternity unit at the local hospital was attacked, leaving 24 women, children and babies dead.
The exact target for Saturday’s attack is unclear.
Reports from the city say it was busy with shoppers ahead of this year’s celebrations for Eid al-Fitr next week.
Students were also streaming from the school. Najiba Arian, Ministry of Education spokeswoman, told Reuters news agency the government-run school was open to boys and girls.
Most of the those hurt were girls, who study in the second of three sessions, according to Ms Arian.
The European Union’s mission in Afghanistan said on Twitter that “targeting primarily students in a girls’ school, makes this an attack on the future of Afghanistan”.
The attack comes against a backdrop of rising violence as the US looks to withdraw all its troops from the country by 11 September.