The blaze started around 3 pm in the factory located around 10 kms from the district headquarters in the Kotwali police station limits.
"So far, eight bodies have been recovered from the debris and 10 injured have been rushed to hospitals," district collector Bharat Yadav told PTI.
A couple of people are still feared to be trapped under the debris, he said.
The cracker factory is owned by one Warish Ahmed.
"What exactly triggered the fire is not yet known. It is possible that someone might have thrown a burning beedi," he said.
The fire has been doused, he said adding the factory was located away from the human settlement.