The girls were among 220 kidnapped in the northern town of Chibok in 2014 and this group is the largest to be freed.
They were exchanged for a number of Boko Haram fighters held by the authorities after “lengthy negotiations” involving Switzerland and the International Committee of the Red Cross, the Nigerian presidency said.
A minister and father of two of the girls said: “I can confirm they have been released.”
A military source said the girls were currently in Banki near the Cameroon border for medical checks before being airlifted to Maiduguri, the capital of Borno state.
They are expected to meet Nigeria’s President Muhammadu Buhari on Sunday in the country’s capital Abuja.
The kidnappings sparked a global campaign #bringbackourgirls supported by then US First Lady Michelle Obama.
Bukky Shonibare one of the founders of the campaign said: “This is exciting news for us, for the parents and the Chibok community. A very exciting and welcome development.”
About 21 Chibok were released in October in a deal brokered by Switzerland and the International Red Cross.
Nigerian President Muhammadu Buhari said last month that the government was in talks to secure the release of the remaining captives.
As well as the Chibok girls, Boko Haram has kidnapped thousands of adults and children.
Militants have killed more than 20,000 people and displaced more than two million during their insurgency aimed at creating an Islamic caliphate in northeast Nigeria.