The bomb went off late on Friday close to a guesthouse where the students were reportedly staying in Pul-e-Alam, the capital of eastern Logar province.
Dozens of people were hurt. Witnesses described roofs collapsing and victims being trapped under the debris.
No group has said it was behind the blast as people broke their fast in the Islamic holy month of Ramadan.
Afghanistan has seen a surge in violence since US President Joe Biden announced US troops would withdraw by 11 September.
A number of buildings were damaged in the explosion at about 19:00 local time (15:30 GMT) including the civilian guesthouse.
Some of those killed were high school students preparing to sit university entrance exams, said Hasibullah Stanekzai, head of Logar's provincial council.
As many as 90 people were injured, interior ministry spokesman Tariq Arian said.
He said the explosion caused widespread damage in the area, including to a hospital and residential houses.
"The roofs of houses have collapsed and people are trapped under the debris," he said.
"The security forces are trying to rescue those trapped."
Footage circulating online showed victims being pulled from the rubble. A ward in a nearby hospital appeared to have suffered blast damage.
The car detonated near the home of the former head of the provincial council and not far from a hospital, Didar Lawang, the spokesperson for Logar's governor, told Reuters news agency.
The British embassy in Kabul condemned the attack, saying "this senseless violence against civilians must stop".
The blast came a day before the US military formally begins to withdraw its remaining troops from Afghanistan.President Biden announced earlier this month that all American troops would leave Afghanistan by the 20th anniversary of the 11 September 2001 attacks in the US.
That decision angered the Taliban who had signed a deal with previous US President Donald Trump agreeing all troops would leave the country by 1 May if the militants upheld the deal
The country has seen a rise in militant violence in recent months, including an increase in civilian casualties.