The mass shooting - the worst in the Czech Republic's history - took place in the philosophy department building of Charles University where the killer was a student, Prague Police Chief Martin Vondrasek said.
The 24-year-old's father has since been found dead.
The suspected gunman also died. His name has not been released.
Mr Vondrasek said police believe the suspect killed his father in his home town of Hostoun, just west of Prague, earlier in the day, and that he had also been planning to kill himself.
Mr Vondrasek said 24 people were injured in the shooting, while authorities warned that the death toll could rise.
Interior Minister Vit Rakusan said investigators do not suspect a link to any extremist ideology or groups.
Later on Thursday, Mr Vondrasek said that, based on a search of the gunman's home, he was also suspected of killing another man and his two-month-old daughter on December 15 in the east of Prague.
Mr Vondrasek described the suspect as an excellent student but did not provide any other information.
The suspect suffered "devastating injuries" but it was not clear if he killed himself or was shot dead in an exchange of gunfire with officers, the police chief said, adding that there was "nothing to suggest that he had an accomplice".
The suspect legally owned several guns, and what he did was "well thought out, a horrible act", Mr Vondrasek said.
The philosophy department was evacuated, said Prague Mayor Bohuslav Svoboda.
One image, which has not yet been verified, appeared to show students clinging onto the outside wall of the university building, on a narrow ledge several storeys up.
University staff were told to "stay put", barricade themselves in rooms and turn off the lights, Reuters reported.
Students also said they had barricaded themselves in classrooms.
"Currently stuck inside my classroom in Prague," Jakob Weizman, a student at Charles University, wrote on X (formerly Twitter).
"Locked the door before the shooter tried to open it." Mr Weizman also posted a photo showing tables and chairs piled up against a door.
Some video footage showed people being evacuated from the building and others trying to hide by a wall.
The police department said the square had been sealed off. It urged people to leave the surrounding streets and stay inside
They added: "The entire building is currently being evacuated and there are several dead and dozens of injured."
The PA news agency spoke to newlyweds Tom Leese, 34, a video producer, and his wife Rachael, 31, an account director, in Prague on their honeymoon.
The couple were having a drink nearby when a policeman rushed in and started "shouting loudly" in Czech.
"I asked for it in English and he said there was an active shooter and to stay inside and stay down," Tom told PA.
"The staff were very calm, turned all the lights off very quickly and urged us to stay calm, the restaurant was relatively quiet."
Tom said that his wife was "still in shock".
"With everyone else being so calm it didn't seem real to me," he said. "We've been in touch with all of our families to let them know that we're safe."
"We obviously can't wait to get home now."
The Czech government declared December 23 a national day of mourning, Prime Minister Petr Fiala said on Thursday.