The Kenyan military said Abu Baara al-Sudani, Omar Nabhan, Khattab al-Kene and Umayr – shown in new CCTV footage – were killed during the standoff.
Kenya said previously 10-15 militants had been involved, but the police chief says the figure may now be four to six.
The al-Shabab group said it carried out the attack on the Westgate mall on 21 September, leaving at least 67 dead.
The al-Qaeda-linked group said the attack was in retaliation for Kenya’s military involvement in Somalia.
The naming of the men came as CCTV footage was aired showing four attackers calmly walking through a room in the mall holding machine guns.
Kenya Defence Forces spokesman Maj Emmanuel Chirchir told Reuters news agency: “I confirm these were the terrorists; they all died in the raid.”
Reuters quoted Maj Chirchir as saying that al-Sudani was an “experienced fighter” from Sudan and was believed to be the leader of the group.
Maj Chirchir said Nabhan was a Kenyan of Arab origin and al-Kene a Somali linked to al-Shabab. Further details about Umayr had not yet been verified, he said.
A Kenyan security analyst told the BBC that at least two of the names would be familiar to the Kenyan intelligence services.
Kenyan police chief David Kimaiyo told Kenya’s KTN television station it was now believed that four to six gunmen had carried out the attack, not 10 to 15.
“None of them managed to escape from the building after the attack,” he said.
Mr Kimaiyo also said that wanted British woman Samantha Lewthwaite had not been involved.
“We have also established that she was not part of the attackers in the building. There was no woman,” he said.
Ms Lewthwaite, 29, is the widow of one of the four suicide bombers who attacked London on 7 July 2005.
Kenya had earlier said five attackers were killed in the security operation and that nine people were in custody.
The BBC’s Gabriel Gatehouse in Nairobi says the latest CCTV footage is from a limited part of the complex and, with some eyewitnesses reporting a two-pronged attack, it is too early to say definitively how many gunmen were in the building.
In addition to the 67 people killed in the attack, a further 39 are still missing, according to the Kenyan Red Cross.
Al-Shabab is banned as a terrorist group by both the US and the UK and is believed to have between 7,000 and 9,000 fighters.
Its members are fighting to create an Islamic state in Somalia.
About 4,000 Kenyan troops were sent to Somalia in October 2011 to help pro-government forces end two decades of violence, with clan-based warlords and Islamist militants all battling for control of the country.
On Saturday, Islamist fighters in southern Somalia said Western forces had launched a night-time raid on one of their bases.
No-one has admitted the attack. US and French special forces have carried out raids in Somalia in recent years.
It is not clear whether the raid was linked to Westgate.