Scores of people were also wounded as the attacker blew himself up in a queue of police officers waiting to enter the base, leaving several bodies and charred debris strewn around the area.
The carnage marks one of the worst attacks on Afghan forces in recent months, despite a renewed international push to restart formal peace talks which stalled last year.
"As a result of the terrorist attack near the Afghan National Civil Order Police headquarters... 20 people were martyred and 29 others were wounded," the interior ministry said in a statement.
A senior ministry source told AFP that all of those killed were policemen, and at least three critically wounded officers were battling for their lives in hospital.
The health ministry said some of those wounded were hit in the chest by flying shrapnel.
Ambulances rushed to the scene, which was cordoned off by authorities after the bombing that coincides with the Taliban's unprecedented winter offensive.
The Taliban claimed responsibility for the attack, with insurgent spokesman Zabihullah Mujahid claiming on Twitter that up to 40 police were killed and wounded.
"Once again, terrorists have targeted a populated area with no regard for innocent lives," NATO said in a statement, adding that civilians were among those wounded.
"The Taliban have no plan for the development of Afghanistan. Targeting those who defend their fellow Afghans does not advance the cause of peace."
The carnage comes just ahead of a third round of four-country "roadmap talks" trying to lay the groundwork for direct dialogue between Kabul and the Islamist group.
Delegates from Afghanistan, Pakistan, China and the United States are set to convene in Islamabad on February 6 in a bid to seek a negotiated end to the Taliban insurgency, now in its fifteenth year.
The Taliban have stepped up attacks on government and foreign targets in Afghanistan this winter, when fighting usually abates, underscoring a worsening security situation.
Afghan security forces have suffered record casualties since NATO ended its combat mission in December 2014, leaving them to battle the resurgent Taliban largely on their own.
In recent months the Taliban briefly captured the northern city of Kunduz, the first urban centre to fall to the insurgents, and have seized territory in the opium-growing southern province of Helmand.
Observers say the intensifying insurgency highlights a push by the militants to seize more territory in an attempt to wrangle greater concessions during talks.
Pakistan -- the Taliban's historic backers -- hosted a milestone first round of talks directly with the Taliban in July.
But the negotiations stalled when the insurgents belatedly confirmed the death of longtime leader Mullah Omar, sparking infighting within the group.
The first and second round of the four-country talks were held last month in Islamabad and Kabul respectively.