Two police officers are among the dead following heavy gunfire and explosions in a campus building at Garissa University.
At least 79 others have been wounded.
Interior minister Joseph Nkaissery claimed the siege was almost over.
“We are mopping up the area,” he told reporters.
Two of the terrorists have been killed and one arrested as he tried to flee, according to Kenya’s interior ministry.
The Red Cross counted 50 students that had been safely freed, while the interior ministry said 500 of 815 students had been accounted for.
Student Michael Bwana, who managed to flee, said most of the hostages were girls.
Kenya Police Chief Joseph Boinet told reporters that gunmen forced their way into the university at 5.30am by shooting at the guards manning the main gate.
“The gunmen shot indiscriminately while inside the university compound,” he said.
“Police… engaged the gunmen in a fierce shootout; however, the attackers retreated and gained entry into one of the hostels.”
A gunfight between security services and the perpetrators lasted several hours, according to the Red Cross.
The area has been sealed off and the army called in to try and “flush out” the attackers.
Students reported seeing five masked gunmen.
The authorities have offered a $215,000 (£145,000) reward for a man called Mohamed Mohamud, who has been linked to the attack.
Collins Wetangula, the vice chairman of the student union, said he was preparing to take a shower when he heard gunshots coming from a dorm.
“All I could hear were footsteps and gunshots; nobody was screaming because they thought this would lead the gunmen to know where they are,” he said.
“The gunmen were saying sisi ni al-Shabab (Swahili for we are al-Shabab).
“If you were a Christian you were shot on the spot. With each blast of the gun I thought I was going to die.”
Grace Kai, a student at a neighbouring college, said there had been warnings of an imminent attack.
“Some strangers had been spotted in Garissa town and were suspected to be terrorists,” she said.
“Then on Monday our college principal told us… that strangers had been spotted in our college. On Tuesday we were released to go home, and our college closed, but the campus remained in session, and now they have been attacked.”
Kenya’s northern and eastern regions, which border Somalia, have been most affected by attacks blamed on al Shabaab Islamists from Somalia.
The militants, who have links to al Qaeda, have vowed to take retribution against Kenya for sending its troops to Somalia.
Al Shabaab was responsible for the deadly attack in 2013 on the Westgate shopping mall. At least 67 people were killed when a group of gunmen rampaged through the centre in Nairobi.
On the latest raid, Kenya’s President Uhuru Kenyatta said: “I extend condolences to the families of those who have perished in this attack. We continue to pray for the quick recovery of the injured, and the safe rescue of those held hostage.”
He added that 10,000 police recruits would be fast-tracked following the attack.