The deaths are France's first casualties in its operation to restore stability to its former colony.
Much of the widescale violence that has killed hundreds of people in the past week has eased, but in the capital Bangui a mosque was set on fire, houses looted and cars torched yesterday. Residents also reported several lynchings.
The country descended into chaos after rebels, mainly from the Muslim Seleka militia, seized power in March. Months of looting, raping and killing has since provoked reprisals by Christian militias.
Michel Djotodia, Seleka leader turned interim president, has lost control of his loose band of fighters, which includes many from Sudan and Chad.
The French soldiers' deaths in the capital were announced just before French President Francois Hollande's office said he would make a quick stop-over in Bangui on his way back from a memorial service for the late Nelson Mandela in South Africa.
His office said: "The head of state expresses his deep respect for the two soldiers' sacrifice."
The 1600-strong French force battled gunmen in Bangui on Monday in an operation to disarm rival Muslim and Christian fighters responsible for violence that has killed at least 465 people since Thursday, according to the Red Cross.
Soldiers have also been deployed to other towns across the country, where a regional African peacekeeping force has struggled to maintain authority.
Paris officials said French troops have restored some stability to Bangui, although shooting broke out when Seleka gunmen refused to hand over weapons to the soldiers.
The two French soldiers, marine paratroopers from the 8th Regiment based in Castres, died after coming under attack at close range during an overnight patrol on Monday, the government said.
A spokesman for the African peacekeeping force in Bangui said the attack took place after residents, who were being harassed by a rebel Seleka commander and his fighters, sought help from the French soldiers.
"They came and tried to disarm the Seleka but gunfire erupted," the spokesman said.
Mr Hollande rushed French troops to the country on Thursday immediately after the UN Security Council authorised France to use lethal force to help African peacekeepers who have been struggling to restore order.
An attack on Bangui by Christian militia, known locally as "anti-balaka" and some fighters loyal to ousted president Francois Bozize, triggered the latest wave of violence.
Tens of thousands of Christians have fled reprisals by Seleka gunmen following the offensive but the French move to disarm all fighters has now weakened Seleka's influence in the capital.
In the Fouh neighbourhood, civilians armed with wooden clubs and machetes attacked a mosque and nearby houses.
At least six people were lynched overnight, mainly during violence targeting Muslims, according to residents in the Bangui neighbourhoods of Benz-vi and Miskine.
The French presence on Bangui's streets yesterday was lighter than on Monday when disarmament operations were under way.
France has lost seven soldiers in a separate operation in Mali, where it sent troops in January to drive back militants threatening to take the capital of Bamako.
The Central African Republic lies at a crossroads of conflict in the heart of Africa, with Sudan, South Sudan and Somalia to the east, the threat from Islamic extremists in the Sahel region to the north and the revolts of the Great Lakes to the southeast.