Jihadist attacks have increased in the Arab world's most populous country since the army ousted Islamist president Mohamed Morsi in 2013 and after a bloody crackdown on his supporters.
Such attacks generally target security forces, particularly in the north of the Sinai Peninsula, where hundreds of police and soldiers have been killed.
The nine were hiding out at a poultry farm west of Cairo and were killed after they opened fire when police came to arrest them, the interior ministry said.
"When police approached, they opened fire and threw several explosive devices at them," prompting return fire, the statement said.
Also Read
Three officers and two policemen were wounded in the confrontation, which lasted several hours.
The statement said the jihadists had been preparing a series of attacks to mark Eid al-Adha, with guns, bombs and grenades recovered.
The ministry said the nine had been "involved in several terrorist operations". Those included an attack on a police building in Cairo on August 20 that wounded 29 people including six policemen, and one on the Italian consulate in the capital on July 11 that killed a passer-by.
The jihadists killed on Friday "were planning to target officers of the police and the army, the judiciary and vital installations," the ministry said.
More than 1,400 people have been killed and tens of thousands jailed in the crackdown on Morsi supporters and the Muslim Brotherhood.
Hundreds, including Morsi, have been sentenced to death in mass trials.