A dam has broken on the flood-swollen River Elbe in eastern Germany, forcing thousands of people to leave their homes around the city of Magdeburg.

Water levels in Magdeburg stood at 7.44m nearly four times higher than normal.

More than 23,000 residents had to leave their homes after many streets and buildings were flooded and electricity was shut off.

The neighbourhood of Rothensee was especially hard-hit by the floods of the Elbe river, with residents being evacuated with tanks, trucks and buses.

"Rothensee is filling up like a bathtub," Germany army spokesman Andre Sabzog told the dpa press agency.

Around 700 soldiers were trying frantically to build a dam of sandbags around a power substation.

Another 8,000 people had been evacuated from the town of Aken and its neighbouring villages after a dam on the Elbe river broke Saturday, police spokesman Uwe Holz said.

Further north on the Elbe river, residents were trying to protect themselves from flooding by building levees along the banks of the rising waterway.

Officials in Saxony-Anhalt state also were investigating what appeared to be a threat to destroy dams.

In Hungary, water levels on the Danube in the capital Budapest are believed to have peaked and officials say defences should prevent flooding in most areas.

Parts of the south and north ends of the Hungarian capital are already under water.

The city's downtown area, including the parliament building and several large hotels near the river bank, are seemingly out of direct danger, thanks to high flood walls.

Officials said nearly 8,000 volunteers and specialised crews in Budapest had strengthened flood walls by packing and placing one million sand bags.

Many are also monitoring defences for any leaks.